[messaging] remove partial sync retry and fix missing datasource error (#4371)

* [messaging] remove partial sync retry and fix missing datasource error

* revert

* fix

* add 429

* fix

* fix

* fix

* remove duplicate log

* fix cron pattern
This commit is contained in:
Weiko
2024-03-08 14:06:21 +01:00
committed by GitHub
parent d2e2e50d8a
commit 250bb6134e
5 changed files with 35 additions and 12 deletions

View File

@ -213,9 +213,25 @@ export class GmailPartialSyncService {
}
if (errors.length) {
throw new Error(
`Error fetching messages for ${connectedAccountId} in workspace ${workspaceId} during partial-sync`,
this.logger.error(
`Error fetching messages for ${connectedAccountId} in workspace ${workspaceId} during partial-sync: ${JSON.stringify(
errors,
null,
2,
)}`,
);
const errorsCanBeIgnored = errors.every((error) => error.code === 404);
const errorsShouldBeRetried = errors.some((error) => error.code === 429);
if (errorsShouldBeRetried) {
return;
}
if (!errorsCanBeIgnored) {
throw new Error(
`Error fetching messages for ${connectedAccountId} in workspace ${workspaceId} during partial-sync`,
);
}
}
startTime = Date.now();