fix(relational): prevent orphaned website_event sessions and keep event pagination stable. Closes #4462.
This commit is contained in:
1 parent
1a91b5f1f3
commit
c3a70b123d
4 files changed
+58
-9
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user