Gate Convex crons behind env flags
This commit is contained in:
parent
fa8672543a
commit
499c7f335c
1 changed files with 10 additions and 7 deletions
|
|
@ -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) {
|
|||
)
|
||||
}
|
||||
|
||||
if (autoPauseCronEnabled) {
|
||||
crons.daily(
|
||||
"auto-pause-internal-lunch",
|
||||
{ hourUTC: 15, minuteUTC: 0 },
|
||||
api.tickets.pauseInternalSessionsForLunch,
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
export default crons
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue