Fix duplicated gmail sync on startup (#9590)

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko
2025-07-23 19:05:01 +07:00
committed by GitHub
parent f080dfbf66
commit fed9ef4e5a
2 changed files with 40 additions and 9 deletions
@@ -70,8 +70,12 @@ export class WorkspaceClient {
async createGmailClient (user: User, authCode?: string): Promise<GmailClient> {
const current = user.socialId?._id !== undefined ? this.getGmailClient(user.socialId?._id) : undefined
if (current !== undefined) return current
this.ctx.info('Creating new gmail client', { workspaceUuid: this.workspace, userId: user.userId })
this.ctx.info('Creating new gmail user', { user })
this.ctx.info('Creating new gmail client', {
workspaceUuid: this.workspace,
userId: user.userId,
email: user.email,
socialId: user.socialId?._id
})
const newClient = await GmailClient.create(
this.ctx,
this.credentials,