From 92c92c161b3195bdfb571284e783f39f369a25a5 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sun, 28 Jul 2024 00:27:36 +0000 Subject: fix(workers): Shutdown workers on SIGTERM --- apps/workers/crawlerWorker.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'apps/workers/crawlerWorker.ts') diff --git a/apps/workers/crawlerWorker.ts b/apps/workers/crawlerWorker.ts index bb226a27..76348821 100644 --- a/apps/workers/crawlerWorker.ts +++ b/apps/workers/crawlerWorker.ts @@ -114,6 +114,10 @@ async function launchBrowser() { logger.error( "[Crawler] Failed to connect to the browser instance, will retry in 5 secs", ); + if (isShuttingDown) { + logger.info("[Crawler] We're shutting down so won't retry."); + return; + } setTimeout(() => { launchBrowser(); }, 5000); -- cgit v1.2.3-70-g09d2