Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone issues #62

Open
MohamedBassem opened this issue May 13, 2017 · 2 comments
Open

Timezone issues #62

MohamedBassem opened this issue May 13, 2017 · 2 comments

Comments

@MohamedBassem
Copy link

Hi,

I have a crontab that contains:

Crono.perform(SendPreLockdownEmailsJob).every 1.days, at: '00:01'

Rails' timezone is set to UTC+4. According to that, the job should always run at 20:00 UTC everyday. The problem is that it sometimes run on 00:01 UTC too for some reason that I don't understand. You can see what I mean from the job's logs:

I, [2017-05-07T20:01:00.000688 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-07T20:01:00.333131 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.33 seconds
I, [2017-05-08T00:01:00.001753 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-08T00:01:00.245461 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.24 seconds
I, [2017-05-08T20:50:36.271039 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-08T20:50:36.365803 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.09 seconds
I, [2017-05-09T00:01:00.000563 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-09T00:01:00.128860 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.13 seconds
I, [2017-05-09T20:01:00.000598 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-09T20:01:00.181408 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.18 seconds
I, [2017-05-10T20:01:00.001467 #9]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-10T20:01:00.304802 #9]  INFO -- : Finished SendPreLockdownEmailsJob in 0.30 seconds
I, [2017-05-11T00:01:00.000725 #9]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-11T00:01:00.238791 #9]  INFO -- : Finished SendPreLockdownEmailsJob in 0.24 seconds
I, [2017-05-12T00:01:00.000630 #9]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-12T00:01:00.233772 #9]  INFO -- : Finished SendPreLockdownEmailsJob in 0.23 seconds
I, [2017-05-12T20:01:00.000284 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-12T20:01:00.329280 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.33 seconds
I, [2017-05-13T00:01:00.000260 #8]  INFO -- : Perform SendPreLockdownEmailsJob
I, [2017-05-13T00:01:00.338922 #8]  INFO -- : Finished SendPreLockdownEmailsJob in 0.34 seconds

So the problem is that the at option is sometimes interpreted as UTC, sometimes interpreted as Rails timezone and sometimes both. Any help?

@trustarun
Copy link

Same issue for me.
In my case, It do not pick the timezone configuration but pick my system time.

System time
2.2.2 :023 > Time.now
=> 2017-11-08 19:04:54 +0530
Scheduling few minute later of above time work
Crono.perform(DataCsvReport).every 1.day, at: {hour: 19 min: 10}

Time configured in application
2.2.2 :024 > Time.zone.now
=> Wed, 08 Nov 2017 08:35:14 EST -05:00
Scheduling few minute later of above configured time do not work
Crono.perform(DataCsvReport).every 1.day, at: {hour: 08 min: 40}

@efreesen
Copy link

We solved it this way:

offset = Time.now.zone

Crono.perform(Worker).every 1.day, at: "00:00 #{offset}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants