try catch worker promote job
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user