Closed BartlomiejSkwira closed 3 years ago
@Eugeny maybe you could help out here?
The get_utc_timezone()
func also seems to be fetching just the UTC timezone.
https://github.com/rq/rq-scheduler/blob/061488e79b82af215f7f98fa1554a0aa84dfd62f/rq_scheduler/utils.py#L71-L74
Holy crap 😨 - my bad! I'm passing a TZ-aware date to croniter
when local time is enabled, so get_next_scheduled_time()
will either return TZ-aware date or "UTC-assumed" objects, but the TZ info is simply ignored by to_unix
afterwards
Fixed in the PR: https://github.com/rq/rq-scheduler/pull/248
Will this make it to a release in a reasonably near future?
I'm not sure I understand how this is supposed to work. With the (supposedly fixed) rel 0.11.0, I have the following cron line:
"0 5 * * *"
with use_local_timezone=True
.
I'm in CEST timezone (currently UTC+2), and I see the job is running every day at 7 am my time. Shouldn't it be running at 5 am my time instead?
How should
use_local_timezone
work in cron method?From what I understand the docs it should use the server timezone (TZ env variable) to interpret the scheduled task. But when I look into the code it seems that it is using UTC even if the setting is set to
True
. Relevant code: https://github.com/rq/rq-scheduler/blob/c79288c1046e5e4e79a46cba2bb6dc035250ff84/rq_scheduler/utils.py#L26I read the above code as:
Use get_utc_timezone if use_local_timezone else use datetime.utcnow()
<- look like UTC in both situations.Am I correct?
My case: I have a task that I want to fire daily at midnight (00:00) California time. Unfortunatelly California has 2 timezones that change (PDT and PST). My workaround was to schedule the task at 8am UTC time which will be 01:00am PDT and 00:00 PST. But maybe there is a better way to solve it with
rq-scheduler