Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
separate notification from clean up
Thiago Araujo da Silva1f47b081d727
diff --git a/backend/src/lib/cron/cron-job.ts b/backend/src/lib/cron/cron-job.tsindex 9661687fc1..25da913640 100644--- a/backend/src/lib/cron/cron-job.ts+++ b/backend/src/lib/cron/cron-job.ts@@ -12,6 +12,7 @@ export const CronJobName = {HealthAlert: "health-alert",DailyReminders: "daily-reminders",DailyResourceCleanup: "daily-resource-cleanup",+ DailyResourceNotification: "daily-resource-notification",FrequentResourceCleanup: "frequent-resource-cleanup",CertificateCleanup: "certificate-cleanup",CertificateV3AutoRenewal: "certificate-v3-auto-renewal",diff --git a/backend/src/services/resource-cleanup/resource-cleanup-queue.ts b/backend/src/services/resource-cleanup/resource-cleanup-queue.tsindex 32fcdcbc8a..39438a27a3 100644--- a/backend/src/services/resource-cleanup/resource-cleanup-queue.ts+++ b/backend/src/services/resource-cleanup/resource-cleanup-queue.ts@@ -76,6 +76,7 @@ export const dailyResourceCleanUpQueueServiceFactory = ({const init = () => {const dailyCleanupTimeoutMs = appCfg.isDailyResourceCleanUpDevelopmentMode ? 5 * 60_000 : 45 * 60_000;+ const dailyNotificationTimeoutMs = appCfg.isDailyResourceCleanUpDevelopmentMode ? 5 * 60_000 : 15 * 60_000;const frequentCleanupTimeoutMs = appCfg.isDailyResourceCleanUpDevelopmentMode ? 5 * 60_000 : 10 * 60_000;cronJob.register({name: CronJobName.DailyResourceCleanup,@@ -93,23 +94,30 @@ export const dailyResourceCleanUpQueueServiceFactory = ({await secretVersionDAL.pruneExcessVersions();await secretVersionV2DAL.pruneExcessVersions();await secretFolderVersionDAL.pruneExcessVersions();- await serviceTokenService.notifyExpiringTokens();- await scimService.notifyExpiringTokens();- await orgService.notifyInvitedUsers();- await auditLogService.checkPostgresAuditLogVolumeMigrationAlert();await userNotificationDAL.pruneNotifications();await keyValueStoreDAL.pruneExpiredKeys();await scepTransactionDAL.pruneExpiredTransactions();- const newlyExpired = await approvalRequestDAL.markExpiredRequests();- if (newlyExpired > 0) {- await certificateRequestDAL.markExpiredApprovalRequests();- }- await approvalRequestGrantsDAL.markExpiredGrants();await identityAccessTokenRevocationDAL.removeExpiredRevocations();await auditLogDAL.pruneAuditLog();}});+ cronJob.register({+ name: CronJobName.DailyResourceNotification,+ pattern: appCfg.isDailyResourceCleanUpDevelopmentMode ? "*/5 * * * *" : "0 0 * * *",+ runHashTtlS: 3 * 24 * 60 * 60,+ handlerTimeoutMs: dailyNotificationTimeoutMs,+ leaseDurationMs: dailyNotificationTimeoutMs,+ enabled: !appCfg.isSecondaryInstance,+ handler: async () => {+ logger.info(`cron[${CronJobName.DailyResourceNotification}]: task started`);+ await serviceTokenService.notifyExpiringTokens();+ await scimService.notifyExpiringTokens();+ await orgService.notifyInvitedUsers();+ await auditLogService.checkPostgresAuditLogVolumeMigrationAlert();+ }+ });+cronJob.register({name: CronJobName.FrequentResourceCleanup,pattern: appCfg.isDailyResourceCleanUpDevelopmentMode ? "*/5 * * * *" : "0 * * * *",