Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

fix(worker): get correct profile id for session end

Carl-Gerhard Lindesvärd2a9f7bbe4f40
diff --git a/apps/worker/src/jobs/events.create-session-end.ts b/apps/worker/src/jobs/events.create-session-end.ts
index 5580edad2..7b1b3ff06 100644
--- a/apps/worker/src/jobs/events.create-session-end.ts
+++ b/apps/worker/src/jobs/events.create-session-end.ts
@@ -150,6 +150,7 @@ export async function createSessionEnd(
name: 'session_end',
duration: sessionDuration,
path: screenViews[0]?.path ?? '',
- createdAt: new Date(getTime(lastEvent?.createdAt) + 100),
+ createdAt: new Date(getTime(lastEvent.createdAt) + 1000),
+ profileId: lastEvent.profileId || sessionStart.profileId,
});
}