[messaging] add more logs to gmail full-sync (#3728)

This commit is contained in:
Weiko
2024-01-31 17:03:11 +01:00
committed by GitHub
parent 389c263e2e
commit e787b4e3b8
2 changed files with 19 additions and 0 deletions

View File

@ -82,6 +82,8 @@ export class FetchMessagesByBatchesService {
},
);
console.log('responseFromGmailQuery', response);
return response;
}

View File

@ -67,6 +67,8 @@ export class GmailFullSyncService {
pageToken: nextPageToken,
});
console.log('messageList query result from gmail', messages);
const messagesData = messages.data.messages;
const messageExternalIds = messagesData
@ -84,6 +86,11 @@ export class GmailFullSyncService {
workspaceId,
);
console.log(
'existingMessagesInDB',
existingMessageChannelMessageAssociations,
);
const existingMessageChannelMessageAssociationsExternalIds =
existingMessageChannelMessageAssociations.map(
(messageChannelMessageAssociation) =>
@ -97,6 +104,8 @@ export class GmailFullSyncService {
),
);
console.log('newMessagesToFetch', messagesToFetch);
const messageQueries =
this.utils.createQueriesFromMessageIds(messagesToFetch);
@ -106,6 +115,8 @@ export class GmailFullSyncService {
accessToken,
);
console.log('messagesToSave', messagesToSave);
if (messagesToSave.length === 0) {
return;
}
@ -135,6 +146,12 @@ export class GmailFullSyncService {
workspaceId,
);
console.log(
`gmail full-sync for workspace ${workspaceId} and account ${connectedAccountId} ${
nextPageToken ? `and ${nextPageToken} pageToken` : ''
} done.`,
);
if (messages.data.nextPageToken) {
await this.messageQueueService.add<GmailFullSyncJobData>(
GmailFullSyncJob.name,