try catch worker promote job
This commit is contained in:
@@ -182,6 +182,7 @@ 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 {
|
||||||
|
try {
|
||||||
// Skip update duration if it's wrong
|
// Skip update duration if it's wrong
|
||||||
// Seems like request is not in right order
|
// Seems like request is not in right order
|
||||||
await prevEventJob.updateData({
|
await prevEventJob.updateData({
|
||||||
@@ -191,9 +192,16 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
|
|||||||
duration,
|
duration,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
job.log(`Failed to update duration: ${e.message}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await prevEventJob.promote();
|
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(
|
||||||
|
|||||||
Reference in New Issue
Block a user