Repository navigation
fix(schedules): normalize default UTC timezone before declarative schedule diff (#5066) - #5069
Conversation
|
|
Hi @MilindChatrabhuji, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| }).window; | ||
| const taskTimezone = task.schedule.timezone ?? "UTC"; | ||
| const existingTimezone = existingSchedule.timezone ?? "UTC"; | ||
| const timezoneChanged = existingTimezone !== taskTimezone; |
There was a problem hiding this comment.
🟡 Schedule fix missing release note
When timezoneChanged preserves a pending run across redeployments, users gain a visible scheduling fix. No server change note announces it.
Learn more
The server-only change stops unchanged UTC schedules from losing their pending job on redeployment. That can affect when a user's task runs. The server change policy requires a release note for a user-facing server fix.
Example: A customer redeploys an hourly task with no explicit timezone. Its pending run now remains scheduled, but the customer sees no mention of the fix in the release notes.
Recommended fix: Add a .server-changes/ entry with area: webapp and type: fix, describing the scheduling behavior in user-facing language.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
|
||
| // Omit explicit timezone to verify default UTC normalization does not trigger false timing change | ||
| await syncDeclarativeSchedules( | ||
| declarativeTasks({ cron: "0 * * * *" }), |
There was a problem hiding this comment.
🔍 Test bypasses normal SDK metadata
The test omits timezone through a cast, but scheduled task registration emits "UTC" for omitted zones. Check whether deployed clients produce metadata this test represents.
Was this helpful? React with 👍 or 👎 to provide feedback.
Overview
Fixes #5066
Problem
When syncing declarative task schedules where the task schedule definition omits an explicit timezone (e.g.
schedules.task({ cron: "0 * * * *" })),task.schedule.timezoneisundefined. Because the database modelTaskScheduledefaults to"UTC", comparingexistingSchedule.timezone("UTC") againsttask.schedule.timezone(undefined) evaluated totrueon every single deployment:This falsely marked declarative schedules as modified on each deployment, triggering unnecessary database updates and unneeded schedule re-registrations.
Solution
"UTC"fallback before evaluatingtimingChangedandpersistedValuesChanged:"UTC"default normalization during schedule creation (task.schedule.timezone ?? "UTC") and quota checks (checkSchedule.call).createBackgroundWorker.server.test.tsverifying that existing schedules and Redis jobs are preserved when a deployment schedule omits an explicit UTC timezone.@algora-pbc /claim #5066