From 499c7f335cef36ee759d1c8409b1c10d8a038958 Mon Sep 17 00:00:00 2001 From: Esdras Renan Date: Tue, 18 Nov 2025 10:28:56 -0300 Subject: [PATCH] Gate Convex crons behind env flags --- convex/crons.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/convex/crons.ts b/convex/crons.ts index b2d29b3..6da0d2b 100644 --- a/convex/crons.ts +++ b/convex/crons.ts @@ -3,8 +3,9 @@ import { api } from "./_generated/api" const crons = cronJobs() -// Keep the handler available but only register it when explicitly enabled in Convex env. +// Flags to keep heavy jobs disabled until the Convex backend stabilizes. const reportsCronEnabled = process.env.REPORTS_CRON_ENABLED === "true" +const autoPauseCronEnabled = process.env.AUTO_PAUSE_ENABLED === "true" if (reportsCronEnabled) { crons.interval( @@ -15,11 +16,13 @@ if (reportsCronEnabled) { ) } -crons.daily( - "auto-pause-internal-lunch", - { hourUTC: 15, minuteUTC: 0 }, - api.tickets.pauseInternalSessionsForLunch, - {} -) +if (autoPauseCronEnabled) { + crons.daily( + "auto-pause-internal-lunch", + { hourUTC: 15, minuteUTC: 0 }, + api.tickets.pauseInternalSessionsForLunch, + {} + ) +} export default crons