fix(worker): handle edge cases when jobs are not delayed

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-25 09:11:54 +02:00
parent 66a49c53cf
commit ea141e99a2
7 changed files with 116 additions and 43 deletions

View File

@@ -44,7 +44,7 @@ async function getCompleteSessionWithSessionStart({
logger: ILogger;
}): Promise<ReturnType<typeof getEvents>> {
const intervals = [6, 12, 24, 72];
let intervalIndex = 0;
for (const hoursInterval of intervals) {
const events = await getCompleteSession({
projectId,
@@ -56,7 +56,10 @@ async function getCompleteSessionWithSessionStart({
return events;
}
logger.warn(`Checking last ${hoursInterval} hours for session_start`);
const nextHoursInterval = intervals[++intervalIndex];
if (nextHoursInterval) {
logger.warn(`Checking last ${nextHoursInterval} hours for session_start`);
}
}
return [];