fix(relational): prevent orphaned website_event sessions and keep event pagination stable. Closes #4462.

This commit is contained in:
Francis Cao committed 2026-08-18 14:16:03 -07:00
1 parent 1a91b5f1f3
commit c3a70b123d
4 files changed
+58 -9

No files matched your search

+3 -1
View File
@@ -156,9 +156,11 @@ export async function POST(request: Request) {
const visitSalt = hash(startOfHour(createdAt).toUTCString());
const sessionId = uuid(sourceId, ip, userAgent, sessionSalt);
const shouldEnsureSession =
!clickhouse.enabled && !!websiteId && !!cache?.sessionId && cache.sessionId !== sessionId;
// Create a session if not found
if (!clickhouse.enabled && !cache?.sessionId) {
if ((!clickhouse.enabled && !cache?.sessionId) || shouldEnsureSession) {
await createSession({
id: sessionId,
websiteId: sourceId,