A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix(workers): crash entire worker process when one of the workers fail
Mohamed Bassemae9e23b35f92
diff --git a/apps/workers/index.ts b/apps/workers/index.tsindex 5282bfd2..f5e0eda9 100644--- a/apps/workers/index.ts+++ b/apps/workers/index.ts@@ -141,12 +141,16 @@ async function main() {importWorkerPromise = importWorker.start();}- await Promise.any([+ let exitCode = 0;+ await Promise.race([Promise.all([...workers.map(({ worker }) => worker.run()),httpServer.serve(),...(importWorkerPromise ? [importWorkerPromise] : []),- ]),+ ]).catch((err: unknown) => {+ exitCode = 1;+ logger.error(`One of the workers failed, shutting down: ${err}`);+ }),shutdownPromise,]);@@ -169,7 +173,7 @@ async function main() {await httpServer.stop();await shutdownEventLogger();await shutdownTracing();- process.exit(0);+ process.exit(exitCode);}main();