OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(buffer): avoid stalled session events
Carl-Gerhard Lindesvärd14468a100488
diff --git a/packages/db/src/buffers/event-buffer-redis.ts b/packages/db/src/buffers/event-buffer-redis.tsindex 590c352e2..6fb72c44e 100644--- a/packages/db/src/buffers/event-buffer-redis.ts+++ b/packages/db/src/buffers/event-buffer-redis.ts@@ -101,9 +101,11 @@ for i, sessionId in ipairs(sessionIds) doresult[resultIndex] = { sessionId = sessionId, events = events }resultIndex = resultIndex + 1totalEvents = totalEvents + #events- if totalEvents >= batchSize then- break- end+ end++ -- Only check if we should break AFTER processing the entire session+ if totalEvents >= batchSize then+ breakendend