From 6934959d5b84bcddfde2f9d29e45ed0569a7362e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Sun, 11 Aug 2024 22:34:11 +0200 Subject: [PATCH] minor worker fix --- apps/worker/src/jobs/events.incoming-event.ts | 5 +---- packages/db/src/services/event.service.ts | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/worker/src/jobs/events.incoming-event.ts b/apps/worker/src/jobs/events.incoming-event.ts index 80e15641..88822761 100644 --- a/apps/worker/src/jobs/events.incoming-event.ts +++ b/apps/worker/src/jobs/events.incoming-event.ts @@ -47,10 +47,7 @@ export async function incomingEvent(job: Job) { }; // this will get the profileId from the alias table if it exists - const profileId = await getProfileIdCached({ - profileId: body.profileId, - projectId, - }); + const profileId = body.profileId ?? ''; const createdAt = new Date(body.timestamp); const url = getProperty('__path'); const { path, hash, query, origin } = parsePath(url); diff --git a/packages/db/src/services/event.service.ts b/packages/db/src/services/event.service.ts index 5f05c117..326fad5a 100644 --- a/packages/db/src/services/event.service.ts +++ b/packages/db/src/services/event.service.ts @@ -459,6 +459,10 @@ export async function getLastScreenViewFromProfileId({ profileId: string; projectId: string; }) { + if (!profileId) { + return null; + } + const eventInBuffer = await eventBuffer.find( (item) => item.event.profile_id === profileId );