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 f1106b760..0ea7857de 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 e057f2b1b..9f7b0cec5 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 81837964c..15c460f49 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 ddadd8c25..b64f93b2e 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 383124964..ab909bc70 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 019b963b3..55a34a8bc 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; }