From 50c1bc39aad36918a2c70d6e8fbf739de9f53399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Thu, 21 Oct 2021 19:15:02 +0200 Subject: [PATCH] defer git-rev-sync call --- src/route/status.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/route/status.ts b/src/route/status.ts index 6b341e8..318ccf5 100644 --- a/src/route/status.ts +++ b/src/route/status.ts @@ -10,10 +10,6 @@ import gitRev from "git-rev-sync"; let gitRevision = "unknown"; -try { - gitRevision = gitRev.long([process.cwd()]); -} catch {} - let ready = false; let lastKnownSessionUuid: CassandraTypes.TimeUuid; @@ -31,6 +27,10 @@ interface StatusSchema { function signalReady(): void { setTimeout(() => { if (!ready) { + try { + gitRevision = gitRev.long([process.cwd()]); + } catch {} + ready = true; } }, 2000); @@ -86,7 +86,7 @@ export async function statusRoute( next: (error?: string) => void ): Promise { if (!ready) { - return next("booting - not ready"); + response.sendStatus(503); } try { const currentStatus = await statusMapper.get({