Handle Network errors in messaging sync (#5795)
In this PR, I'm doing 2 things: - refresh connectedAccount token on message-list-fetch. It's currently only refresh while doing the messages-import. However messages-import stage are only triggered if new messages are detected (which could take days or week depending of the messageChannel activity). We should also refresh it while trying to fetch the list - handle Unhandled Gmail error code 500 with reason "backendError". These can occur on gmail side. In this case, we just retry later.
This commit is contained in:
@ -94,6 +94,24 @@ export class MessagingErrorHandlingService {
|
||||
workspaceId,
|
||||
);
|
||||
break;
|
||||
case 500:
|
||||
if (reason === 'backendError') {
|
||||
await this.handleRateLimitExceeded(
|
||||
error,
|
||||
syncStep,
|
||||
messageChannel,
|
||||
workspaceId,
|
||||
);
|
||||
} else {
|
||||
await this.messagingChannelSyncStatusService.markAsFailedUnknownAndFlushMessagesToImport(
|
||||
messageChannel.id,
|
||||
workspaceId,
|
||||
);
|
||||
throw new Error(
|
||||
`Unhandled Gmail error code ${code} with reason ${reason}`,
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'ECONNRESET':
|
||||
case 'ENOTFOUND':
|
||||
case 'ECONNABORTED':
|
||||
|
||||
Reference in New Issue
Block a user