A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix(workers): Shutdown workers on SIGTERM
MohamedBassem92c92c161b31
diff --git a/apps/workers/crawlerWorker.ts b/apps/workers/crawlerWorker.tsindex 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);diff --git a/apps/workers/index.ts b/apps/workers/index.tsindex 39741aa8..e576776a 100644--- a/apps/workers/index.ts+++ b/apps/workers/index.ts@@ -23,6 +23,11 @@ async function main() {Promise.all([crawler.run(), openai.run(), search.run()]),shutdownPromise,]);+ logger.info("Shutting down crawler, openai and search workers ...");++ crawler.stop();+ openai.stop();+ search.stop();}main();