diff --git a/src/services/cronJobs/checkProjectVerificationStatus.ts b/src/services/cronJobs/checkProjectVerificationStatus.ts index df386c956..eb5f226c1 100644 --- a/src/services/cronJobs/checkProjectVerificationStatus.ts +++ b/src/services/cronJobs/checkProjectVerificationStatus.ts @@ -96,8 +96,18 @@ export const checkProjectVerificationStatus = async () => { foundProjectsCount: projects?.length, }); - // Run all iterations async, resulting in array of promises - await Promise.all(projects.map(remindUpdatesOrRevokeVerification)); + for (const project of projects) { + try { + await remindUpdatesOrRevokeVerification(project); + } catch (error) { + logger.error('Error in remindUpdatesOrRevokeVerification', { + projectId: project.id, + projectSlug: project.slug, + projectVerificationStatus: project.verificationStatus, + error, + }); + } + } if (projects.length > 0) { await Promise.all([ @@ -109,6 +119,11 @@ export const checkProjectVerificationStatus = async () => { }; const remindUpdatesOrRevokeVerification = async (project: Project) => { + logger.debug('remindUpdatesOrRevokeVerification() has been called', { + projectId: project.id, + projectSlug: project.slug, + projectVerificationStatus: project.verificationStatus, + }); // Projects up for revoking when 30 days are done after feature release if ( new Date() >= new Date(projectUpdatesFirstRevokeBatchDate) && @@ -182,7 +197,7 @@ const remindUpdatesOrRevokeVerification = async (project: Project) => { const user = await User.findOne({ where: { id: Number(project.admin) } }); await sendProperNotification(project, project.verificationStatus as string); - await sleep(1000); + await sleep(300); }; const sendProperNotification = (