Fix bull-mq retry option and exceptions not being captured for jobs (#3905)
* Fix bull-mq retry option * fix exception inside worker * add logs * fix after review
This commit is contained in:
@ -93,7 +93,11 @@ export class BullMQDriver implements MessageQueueDriver {
|
|||||||
`Queue ${queueName} is not registered, make sure you have added it as a queue provider`,
|
`Queue ${queueName} is not registered, make sure you have added it as a queue provider`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const queueOptions = { jobId: options?.id, priority: options?.priority };
|
const queueOptions = {
|
||||||
|
jobId: options?.id,
|
||||||
|
priority: options?.priority,
|
||||||
|
attempts: 1 + (options?.retryLimit || 0),
|
||||||
|
};
|
||||||
|
|
||||||
await this.queueMap[queueName].add(jobName, data, queueOptions);
|
await this.queueMap[queueName].add(jobName, data, queueOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,12 @@ async function bootstrap() {
|
|||||||
.select(JobsModule)
|
.select(JobsModule)
|
||||||
.get(jobClassName, { strict: true });
|
.get(jobClassName, { strict: true });
|
||||||
|
|
||||||
await job.handle(jobData.data);
|
try {
|
||||||
|
await job.handle(jobData.data);
|
||||||
|
} catch (err) {
|
||||||
|
exceptionHandlerService?.captureExceptions([err]);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -75,7 +75,6 @@ export class GmailFullSyncCommand extends CommandRunner {
|
|||||||
connectedAccountId: connectedAccount.id,
|
connectedAccountId: connectedAccount.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: `${workspaceId}-${connectedAccount.id}`,
|
|
||||||
retryLimit: 2,
|
retryLimit: 2,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -75,7 +75,6 @@ export class GmailPartialSyncCommand extends CommandRunner {
|
|||||||
connectedAccountId: connectedAccount.id,
|
connectedAccountId: connectedAccount.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: `${workspaceId}-${connectedAccount.id}`,
|
|
||||||
retryLimit: 2,
|
retryLimit: 2,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -37,13 +37,6 @@ export class MessagingPersonListener {
|
|||||||
|
|
||||||
@OnEvent('person.updated')
|
@OnEvent('person.updated')
|
||||||
handleUpdatedEvent(payload: ObjectRecordUpdateEvent<PersonObjectMetadata>) {
|
handleUpdatedEvent(payload: ObjectRecordUpdateEvent<PersonObjectMetadata>) {
|
||||||
console.log(
|
|
||||||
objectRecordUpdateEventChangedProperties(
|
|
||||||
payload.previousRecord,
|
|
||||||
payload.updatedRecord,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
objectRecordUpdateEventChangedProperties(
|
objectRecordUpdateEventChangedProperties(
|
||||||
payload.previousRecord,
|
payload.previousRecord,
|
||||||
|
|||||||
@ -109,6 +109,10 @@ export class GmailFullSyncService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (messagesToSave.length === 0) {
|
if (messagesToSave.length === 0) {
|
||||||
|
this.logger.log(
|
||||||
|
`gmail full-sync for workspace ${workspaceId} and account ${connectedAccountId} done with nothing to import.`,
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user