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
Wasn't sure whether to do this here, or raise an issue. I've never seen this Discussion thing on GitHub before!
Since Rails 6, ActiveJob has been able to honor/propagate the Timezone present when scheduling a job.
I was looking for a way to set up cron definitions so that along with the cron schedule happening in a certain timezone, the execution of the job would also be in that timezone. I had thought doing something like SomeJob.set(timezone: 'America/Chicago').perform_now would work (and then following that line of thinking in the GoodJob cron config adding a timezone param into the set config option). But that isn't the case, sadly.
However, it seems like GoodJob could potentially act as a middleman and utilize that set config, or even just a timezone config under each cronjob definition.
cron: {my_job: {class: 'MyJob',cron: 'every day at 12AM America/Chicago',timezone: 'America/Chicago'# Could also use use `set` instead, since this will be reflecting the ActiveJob `timezone` param, similar to setting `priority`. # That would allow for a `my_job[:timezone]` config to potentially control the `cron` timezone in the future instead of having# to include it (`{ cron: '@midnight'. timezone: 'America/Chicago' }`)# set: { timezone: 'America/Chicago' },}},
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
Wasn't sure whether to do this here, or raise an issue. I've never seen this Discussion thing on GitHub before!
Since Rails 6, ActiveJob has been able to honor/propagate the Timezone present when scheduling a job.
I was looking for a way to set up cron definitions so that along with the
cronschedule happening in a certain timezone, the execution of the job would also be in that timezone. I had thought doing something likeSomeJob.set(timezone: 'America/Chicago').perform_nowwould work (and then following that line of thinking in the GoodJobcronconfig adding atimezoneparam into thesetconfig option). But that isn't the case, sadly.However, it seems like GoodJob could potentially act as a middleman and utilize that
setconfig, or even just atimezoneconfig under each cronjob definition.app/models/good_job/cron_entry.rb
Beta Was this translation helpful? Give feedback.
All reactions