diff --git a/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts b/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts index 40ece00996..2b312dbdcd 100644 --- a/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts +++ b/apps/api/v2/src/modules/organizations/delegation-credentials/services/organizations-delegation-credential.service.ts @@ -118,6 +118,22 @@ export class OrganizationsDelegationCredentialService { const results = await Promise.allSettled( delegatedUserProfiles.map(async (profile) => { if (profile.userId) { + if (this.configService.get("enableAsyncTasker")) { + this.logger.log(`Adding default calendar job for user with id: ${profile.userId}`); + await this.calendarsTasker.dispatch( + "ensureDefaultCalendars", + { + userId: profile.userId, + }, + { + idempotencyKey: `${DEFAULT_CALENDARS_JOB}_${profile.userId}`, + idempotencyKeyTTL: "1h", + tags: [`${DEFAULT_CALENDARS_JOB}_${profile.userId}`], + } + ); + return; + } + const job = await this.calendarsQueue.getJob(`${DEFAULT_CALENDARS_JOB}_${profile.userId}`); if (job) { await job.remove();