fix(preview): add 60-second grace period before zombie killer murders booting dev servers throwing 504s
This commit is contained in:
@@ -825,8 +825,17 @@ async function loadPreviews(projectId: string): Promise<Preview[]> {
|
||||
ping.status === 504 ||
|
||||
ping.status === 404
|
||||
) {
|
||||
// GRACE PERIOD: If the server was started less than 60 seconds ago,
|
||||
// Traefik might return a 502/504 simply because the Node process hasn't
|
||||
// finished booting and binding to the port yet. Do not kill it!
|
||||
const ageMs = Date.now() - new Date(r.started_at).getTime();
|
||||
if (ageMs < 60_000) {
|
||||
activePreviews.push(r); // Give it the benefit of the doubt
|
||||
return;
|
||||
}
|
||||
|
||||
console.warn(
|
||||
`[anatomy] Preview zombie detected for ${r.preview_url} (HTTP ${ping.status}). Marking stopped.`,
|
||||
`[anatomy] Preview zombie detected for ${r.preview_url} (HTTP ${ping.status}, age ${Math.round(ageMs / 1000)}s). Marking stopped.`,
|
||||
);
|
||||
await query(
|
||||
`UPDATE fs_dev_servers SET state = 'stopped' WHERE id = $1`,
|
||||
|
||||
Reference in New Issue
Block a user