Skip to content

The open alternative to Salesforce, designed for AI.

[messaging] fix empty history (#4218)

Weiko47656479baa6
diff --git a/packages/twenty-server/src/workspace/messaging/services/gmail-partial-sync.service.ts b/packages/twenty-server/src/workspace/messaging/services/gmail-partial-sync.service.ts
index d62db8d2f0b..08771134a01 100644
--- a/packages/twenty-server/src/workspace/messaging/services/gmail-partial-sync.service.ts
+++ b/packages/twenty-server/src/workspace/messaging/services/gmail-partial-sync.service.ts
@@ -81,7 +81,7 @@ export class GmailPartialSyncService {
throw new Error('No history id found');
}
- if (newHistoryId === lastSyncHistoryId) {
+ if (newHistoryId === lastSyncHistoryId || !history?.history?.length) {
this.logger.log(
`gmail partial-sync for workspace ${workspaceId} and account ${connectedAccountId} done with nothing to update.`,
);