Repository navigation
Conversation
|
|
Hi @ghazy2001, 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. |
| await syncDeclarativeSchedules( | ||
| declarativeTasks({ cron: "0 * * * *" }), | ||
| noWorker, | ||
| asEnv(prodEnv), | ||
| prisma, | ||
| engine | ||
| ); |
There was a problem hiding this comment.
🔍 Test bypasses worker metadata validation
The new test passes an omitted timezone directly to syncDeclarativeSchedules. ScheduleMetadata requires one, while schedules.task emits UTC by default. Investigate which production client can reach this case.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
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 |
Fixes #5066
Problem
When declarative task schedules omit an explicit timezone (e.g.
schedules.task({ cron: "0 * * * *" })),task.schedule.timezoneevaluates toundefined. However,TaskSchedulein the database schema defaultstimezoneto"UTC".During
syncDeclarativeSchedules, comparingexistingSchedule.timezone("UTC") againsttask.schedule.timezone(undefined) evaluated totrueon bothtimingChangedandpersistedValuesChanged:taskSchedule.update).preserveExistingJob: !timingChangedasfalse, causing the scheduler engine to cancel and re-register the existing Redis job even when the schedule expression and timing were completely unchanged.Solution
"UTC"vianextTimezone = task.schedule.timezone ?? "UTC"increateBackgroundWorker.server.tsacrossprepareDeclarativeSchedules,validate, andapply(both update and create paths).timezoneoptional indeclarativeTaskstest helper and added automated container test increateBackgroundWorker.server.test.tsverifying that omitting an explicit timezone matches existing"UTC"schedules without bumpingupdatedAtor replacing the scheduled Redis job.