fix MailboxConcurrency And email format without @ (#11133)

This commit is contained in:
Guillim
2025-03-25 11:40:58 +01:00
committed by GitHub
parent de1f8a4706
commit 96c61df007
5 changed files with 16 additions and 24 deletions

View File

@ -58,14 +58,13 @@ export class CalendarEventImportErrorHandlerService {
break; break;
case CalendarEventImportDriverExceptionCode.UNKNOWN: case CalendarEventImportDriverExceptionCode.UNKNOWN:
case CalendarEventImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR: case CalendarEventImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
default:
await this.handleUnknownException( await this.handleUnknownException(
exception, exception,
calendarChannel, calendarChannel,
workspaceId, workspaceId,
); );
break; break;
default:
throw exception;
} }
} }

View File

@ -104,6 +104,10 @@ export class MicrosoftGetMessagesService {
), ),
]; ];
const safeParticipantsFormat = participants.filter((participant) => {
return participant.handle.includes('@');
});
return { return {
externalId: response.id, externalId: response.id,
subject: response.subject || '', subject: response.subject || '',
@ -116,7 +120,7 @@ export class MicrosoftGetMessagesService {
response.from.emailAddress.address, response.from.emailAddress.address,
connectedAccount, connectedAccount,
), ),
participants: participants, participants: safeParticipantsFormat,
attachments: [], attachments: [],
}; };
}); });

View File

@ -1,7 +1,5 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { GraphError } from '@microsoft/microsoft-graph-client';
import { import {
MessageImportDriverException, MessageImportDriverException,
MessageImportDriverExceptionCode, MessageImportDriverExceptionCode,
@ -9,7 +7,7 @@ import {
@Injectable() @Injectable()
export class MicrosoftHandleErrorService { export class MicrosoftHandleErrorService {
public handleMicrosoftMessageFetchError(error: GraphError): void { public handleMicrosoftMessageFetchError(error: any): void {
if (!error.statusCode) { if (!error.statusCode) {
throw new MessageImportDriverException( throw new MessageImportDriverException(
`Microsoft Graph API unknown error: ${error}`, `Microsoft Graph API unknown error: ${error}`,
@ -32,7 +30,7 @@ export class MicrosoftHandleErrorService {
} }
throw new MessageImportDriverException( throw new MessageImportDriverException(
`Microsoft Graph API error: ${error.message}`, `Microsoft driver error: ${error.message}`,
MessageImportDriverExceptionCode.UNKNOWN, MessageImportDriverExceptionCode.UNKNOWN,
); );
} }

View File

@ -57,14 +57,6 @@ export class MessageImportExceptionHandlerService {
workspaceId, workspaceId,
); );
break; break;
case MessageImportDriverExceptionCode.UNKNOWN:
case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
await this.handleUnknownException(
exception,
messageChannel,
workspaceId,
);
break;
case MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR: case MessageImportDriverExceptionCode.SYNC_CURSOR_ERROR:
await this.handlePermanentException( await this.handlePermanentException(
exception, exception,
@ -72,8 +64,15 @@ export class MessageImportExceptionHandlerService {
workspaceId, workspaceId,
); );
break; break;
case MessageImportDriverExceptionCode.UNKNOWN:
case MessageImportDriverExceptionCode.UNKNOWN_NETWORK_ERROR:
default: default:
throw exception; await this.handleUnknownException(
exception,
messageChannel,
workspaceId,
);
break;
} }
} }

View File

@ -117,14 +117,6 @@ export class MessagingMessagesImportService {
MESSAGING_GMAIL_USERS_MESSAGES_GET_BATCH_SIZE, MESSAGING_GMAIL_USERS_MESSAGES_GET_BATCH_SIZE,
); );
if (connectedAccount.id === '74998005-0180-4d6a-9fa4-fe733c4707f8') {
this.logger.log(
'[TMP] Debugging messages import for account:',
messageChannel.connectedAccount.id,
);
this.logger.log('[TMP] messageIdsToFetch:', messageIdsToFetch);
}
if (!messageIdsToFetch?.length) { if (!messageIdsToFetch?.length) {
await this.messageChannelSyncStatusService.markAsCompletedAndSchedulePartialMessageListFetch( await this.messageChannelSyncStatusService.markAsCompletedAndSchedulePartialMessageListFetch(
[messageChannel.id], [messageChannel.id],