try catch worker promote job

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-05-04 14:09:42 +02:00
parent d5cc2239ed
commit ba6ca9b13c

View File

@@ -182,18 +182,26 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
if (duration < 0) { if (duration < 0) {
job.log(`prevEvent ${JSON.stringify(prevEvent, null, 2)}`); job.log(`prevEvent ${JSON.stringify(prevEvent, null, 2)}`);
} else { } else {
// Skip update duration if it's wrong try {
// Seems like request is not in right order // Skip update duration if it's wrong
await prevEventJob.updateData({ // Seems like request is not in right order
type: 'createEvent', await prevEventJob.updateData({
payload: { type: 'createEvent',
...prevEvent, payload: {
duration, ...prevEvent,
}, duration,
}); },
});
} catch (e) {
job.log(`Failed to update duration: ${e.message}`);
}
} }
await prevEventJob.promote(); try {
await prevEventJob.promote();
} catch (e) {
job.log(`Failed to promote job: ${e.message}`);
}
} }
} else if (payload.name !== 'screen_view') { } else if (payload.name !== 'screen_view') {
job.log( job.log(