Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -134,16 +134,21 @@ export function startWorkerHealthServer(options: WorkerHealthServerOptions): Wor
|
||||
}
|
||||
|
||||
async function runWithTimeout(probe: HealthProbe, timeoutMs: number, label: string): Promise<HealthProbeResult> {
|
||||
let timeout: NodeJS.Timeout | undefined;
|
||||
try {
|
||||
const result = await Promise.race([
|
||||
Promise.resolve().then(() => probe()),
|
||||
new Promise<HealthProbeResult>((resolve) =>
|
||||
setTimeout(() => resolve({ ok: false, error: `${label} probe timed out after ${timeoutMs}ms` }), timeoutMs)
|
||||
),
|
||||
new Promise<HealthProbeResult>((resolve) => {
|
||||
timeout = setTimeout(() => resolve({ ok: false, error: `${label} probe timed out after ${timeoutMs}ms` }), timeoutMs);
|
||||
}),
|
||||
]);
|
||||
return result;
|
||||
} catch (error) {
|
||||
return { ok: false, error: serialiseError(error).message };
|
||||
} finally {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user