You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Declarative schedule sync detects false updates when comparing default UTC timezone #5066
When syncing declarative schedules where the task schedule omits an explicit timezone, the sync routine marks the schedule as modified on every deployment. In syncDeclarativeSchedules, comparing the existing database schedule timezone ("UTC") against the undefined task schedule timezone triggers an unnecessary schedule update.
Can send a quick PR normalizing timezone defaults before the diff check if that helps!
In Prisma schema, TaskSchedule.timezone defaults to "UTC". When declarative task definitions in code omit an explicit timezone (e.g. schedules.task({ cron: "0 * * * *" })), task.schedule.timezone is undefined.
In syncDeclarativeSchedules, existingSchedule.timezone !== task.schedule.timezone evaluated "UTC" !== undefined to true, falsely flagging both timingChanged and persistedValuesChanged. This triggered redundant taskSchedule.update database writes and invalidated active Redis scheduled jobs on every deployment.
Normalized nextTimezone = task.schedule.timezone ?? "UTC" across prepareDeclarativeSchedules, validate, and apply (create and update).
Added automated container test in createBackgroundWorker.server.test.ts verifying that omitting an explicit timezone matches existing "UTC" schedules without bumping updatedAt or replacing the scheduled Redis job.
Activity
ghazy2001 commentedon Oct 29, 2026
Hey @shafiktanbir! I have opened PR #5087 resolving this issue.
Root Cause & Resolution
TaskSchedule.timezonedefaults to"UTC". When declarative task definitions in code omit an explicit timezone (e.g.schedules.task({ cron: "0 * * * *" })),task.schedule.timezoneisundefined.syncDeclarativeSchedules,existingSchedule.timezone !== task.schedule.timezoneevaluated"UTC" !== undefinedtotrue, falsely flagging bothtimingChangedandpersistedValuesChanged. This triggered redundanttaskSchedule.updatedatabase writes and invalidated active Redis scheduled jobs on every deployment.nextTimezone = task.schedule.timezone ?? "UTC"acrossprepareDeclarativeSchedules,validate, andapply(create and update).createBackgroundWorker.server.test.tsverifying that omitting an explicit timezone matches existing"UTC"schedules without bumpingupdatedAtor replacing the scheduled Redis job.