OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(worker): avoid workers getting blocked
Carl-Gerhard Lindesvärd447f303aa48a
diff --git a/apps/worker/src/jobs/events.incoming-event.ts b/apps/worker/src/jobs/events.incoming-event.tsindex 87bc24180..b5f7d314c 100644--- a/apps/worker/src/jobs/events.incoming-event.ts+++ b/apps/worker/src/jobs/events.incoming-event.ts@@ -183,6 +183,10 @@ function getSessionEndWithPriority(return async (args) => {const res = await getSessionEnd(args);+ if (count > 10) {+ throw new Error('Failed to get session end');+ }+// if we get simultaneous requests we want to avoid race conditions with getting the session end// one of the events will get priority and the other will wait for the first to finishif (res === null && priority === false) {@@ -190,10 +194,6 @@ function getSessionEndWithPriority(return getSessionEndWithPriority(priority, count + 1)(args);}- if (count > 10) {- throw new Error('Failed to get session end');- }-return res;};}