try fix bugs

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-28 21:24:29 +01:00
parent 888ede680e
commit 93cf5dbc0a
4 changed files with 11 additions and 11 deletions

View File

@@ -164,16 +164,11 @@ export async function postEvent(
return reply.status(200).send('');
}
const [geo, eventsJobs, events] = await Promise.all([
const [geo, eventsJobs] = await Promise.all([
parseIp(ip),
eventsQueue.getJobs(['delayed']),
getEvents(
`SELECT * FROM events WHERE name = 'session_start' AND profile_id = '${profileId}' AND project_id = '${projectId}' ORDER BY created_at DESC LIMIT 1`
),
]);
const sessionStartEvent = events[0];
// find session_end job
const sessionEndJobCurrentDeviceId = findJobByPrefix(
eventsJobs,
@@ -216,6 +211,10 @@ export async function postEvent(
);
}
const [sessionStartEvent] = await getEvents(
`SELECT * FROM events WHERE name = 'session_start' AND device_id = '${deviceId}' AND project_id = '${projectId}' ORDER BY created_at DESC LIMIT 1`
);
request.log.info(
{
ip,
@@ -228,7 +227,8 @@ export async function postEvent(
deviceId,
bot,
geo,
events,
sessionStartEvent,
path,
},
'incoming event'
);