diff --git a/packages/twenty-server/src/integrations/message-queue/drivers/bullmq.driver.ts b/packages/twenty-server/src/integrations/message-queue/drivers/bullmq.driver.ts index f1106b760f..0ea7857de2 100644 --- a/packages/twenty-server/src/integrations/message-queue/drivers/bullmq.driver.ts +++ b/packages/twenty-server/src/integrations/message-queue/drivers/bullmq.driver.ts @@ -93,7 +93,11 @@ export class BullMQDriver implements MessageQueueDriver { `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); } diff --git a/packages/twenty-server/src/queue-worker.ts b/packages/twenty-server/src/queue-worker.ts index e057f2b1b9..9f7b0cec5f 100644 --- a/packages/twenty-server/src/queue-worker.ts +++ b/packages/twenty-server/src/queue-worker.ts @@ -39,7 +39,12 @@ async function bootstrap() { .select(JobsModule) .get(jobClassName, { strict: true }); - await job.handle(jobData.data); + try { + await job.handle(jobData.data); + } catch (err) { + exceptionHandlerService?.captureExceptions([err]); + throw err; + } }); } } catch (err) { diff --git a/packages/twenty-server/src/workspace/messaging/commands/gmail-full-sync.command.ts b/packages/twenty-server/src/workspace/messaging/commands/gmail-full-sync.command.ts index 81837964cc..15c460f49b 100644 --- a/packages/twenty-server/src/workspace/messaging/commands/gmail-full-sync.command.ts +++ b/packages/twenty-server/src/workspace/messaging/commands/gmail-full-sync.command.ts @@ -75,7 +75,6 @@ export class GmailFullSyncCommand extends CommandRunner { connectedAccountId: connectedAccount.id, }, { - id: `${workspaceId}-${connectedAccount.id}`, retryLimit: 2, }, ); diff --git a/packages/twenty-server/src/workspace/messaging/commands/gmail-partial-sync.command.ts b/packages/twenty-server/src/workspace/messaging/commands/gmail-partial-sync.command.ts index ddadd8c254..b64f93b2e9 100644 --- a/packages/twenty-server/src/workspace/messaging/commands/gmail-partial-sync.command.ts +++ b/packages/twenty-server/src/workspace/messaging/commands/gmail-partial-sync.command.ts @@ -75,7 +75,6 @@ export class GmailPartialSyncCommand extends CommandRunner { connectedAccountId: connectedAccount.id, }, { - id: `${workspaceId}-${connectedAccount.id}`, retryLimit: 2, }, ); diff --git a/packages/twenty-server/src/workspace/messaging/listeners/messaging-person.listener.ts b/packages/twenty-server/src/workspace/messaging/listeners/messaging-person.listener.ts index 3831249644..ab909bc709 100644 --- a/packages/twenty-server/src/workspace/messaging/listeners/messaging-person.listener.ts +++ b/packages/twenty-server/src/workspace/messaging/listeners/messaging-person.listener.ts @@ -37,13 +37,6 @@ export class MessagingPersonListener { @OnEvent('person.updated') handleUpdatedEvent(payload: ObjectRecordUpdateEvent) { - console.log( - objectRecordUpdateEventChangedProperties( - payload.previousRecord, - payload.updatedRecord, - ), - ); - if ( objectRecordUpdateEventChangedProperties( payload.previousRecord, diff --git a/packages/twenty-server/src/workspace/messaging/services/gmail-full-sync.service.ts b/packages/twenty-server/src/workspace/messaging/services/gmail-full-sync.service.ts index 019b963b39..55a34a8bc0 100644 --- a/packages/twenty-server/src/workspace/messaging/services/gmail-full-sync.service.ts +++ b/packages/twenty-server/src/workspace/messaging/services/gmail-full-sync.service.ts @@ -109,6 +109,10 @@ export class GmailFullSyncService { ); if (messagesToSave.length === 0) { + this.logger.log( + `gmail full-sync for workspace ${workspaceId} and account ${connectedAccountId} done with nothing to import.`, + ); + return; }