From adef17240599b0c47abefa4e0b610b9acff5fb7c Mon Sep 17 00:00:00 2001 From: Henry Fontanier Date: Tue, 17 Oct 2023 16:04:36 +0200 Subject: [PATCH] fixes --- front/lib/api/assistant/pubsub.ts | 4 ++-- front/pages/api/[preStopSecret]/prestop.ts | 3 +++ front/tsconfig.json | 3 +-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/front/lib/api/assistant/pubsub.ts b/front/lib/api/assistant/pubsub.ts index 7eff62bc6539..155cb1d0292f 100644 --- a/front/lib/api/assistant/pubsub.ts +++ b/front/lib/api/assistant/pubsub.ts @@ -194,7 +194,7 @@ export async function retryAgentMessageWithPubSub( ): Promise> { const promise: Promise> = new Promise( (resolve) => { - void (async () => { + void wakeLock(async () => { const redis = await redisClient(); let didResolve = false; try { @@ -255,7 +255,7 @@ export async function retryAgentMessageWithPubSub( ); } } - })(); + }); } ); diff --git a/front/pages/api/[preStopSecret]/prestop.ts b/front/pages/api/[preStopSecret]/prestop.ts index 001f80adb9c2..c309a079fc1c 100644 --- a/front/pages/api/[preStopSecret]/prestop.ts +++ b/front/pages/api/[preStopSecret]/prestop.ts @@ -22,6 +22,9 @@ async function handler( return; } + logger.info("Received prestop request, waiting 10s"); + await new Promise((resolve) => setTimeout(resolve, 10000)); + while (!wakeLockIsFree()) { logger.info("Waiting for wake lock to be free"); await new Promise((resolve) => setTimeout(resolve, 1000)); diff --git a/front/tsconfig.json b/front/tsconfig.json index 0898663dc345..d40b15b9d867 100644 --- a/front/tsconfig.json +++ b/front/tsconfig.json @@ -17,8 +17,7 @@ "downlevelIteration": true, "paths": { "@app/*": ["./*"] - }, - "allowUnreachableCode": true + } }, "include": [ "global.d.ts",