Execution of Schedulers in UTC?

Schedulers execute based on the timezone associated with the System Administrator. If we set a Scheduler to be executed at  

Min: 30

Hour: 06

Date: *

Month: *

Day: 1-5

This means this should be executed at 6:30 a.m. Monday - Friday.

However, it's executing not in UTC but in the Timezone of the Admin, prior to the current release of Sugar. We could log in as the Admin user and set the Admin user's timezone. In the current version, the timezone is automatically set. We have global users who when performing administrative tasks log in as Admin. This results in the timezone changing based on the location of the person logged in.

How can we either pin the Admin to UTC timezone and/or ensure that schedulers are always executed in UTC?

Thoughts?

We are using Sugar Enterprise 13.0.1.

edited for clarity.

Parents
  • Hi  ,

    interesting question and I'll be following to see what is suggested here...

    Is it the Admin's timezone or the timezone of the server on which the crontab is running that makes a difference?
    Also, how does the current system set the admin timezone? What is it basing it on?

    I may be an admin on the east coast administering a server on the west coast... I may also be one of several admins around the world...
    so my browser timezone will by different from my system's timezone and from other admins' timezones...

    Is it user id = 1 that dictates the scheduling times?

    FrancescaS

  • The timezone is based on the function 

    $current_user->getSystemUser();

    It's this user's timezone that is used. , when you log in to Sugar 13. The timezone is automatically set based on the timezone of the user's computer. 

    If for example, I'm in CA when I log in. The timezone will automatically change. If I travel to NY, the timezone will change when I log in again. 

  • Hi  ,
    Can I ask how did you get to this conclusion?
    Cheers,
    Andras

  •  

    I noticed that my schedulers were not executing when I was expecting them to based on the interval set. 

    I then debugged the issue using xdebug and observed that when executing cron.php the system uses the administrator's timezone to determine when to execute. 

    In my image in the origin description, I would expect my Scheduler to execute Monday - Friday at 06:30 UTC. However, my administrator's timezone is America/Los_Angeles (Pacific Time). Which is causing it to run at 22:30 the day before. Also the time changes in the US when daylight saving changes. So 22:30 is different when the timezone is in PST and PDT.

    Further, if I travel and log in as the admin and I'm now in America/New_York (Eastern Time). All of my schedulers are now running in EST/EDT times. 

  • I've tracked this down, and I think you're correct. modules/Schedulers/Schedulers.php in line 93 is picking up User 1's time zone. This is then used for building the job queue from the Scheduled Tasks. Have you opened a bug about this? I think it's worth it.

     I also think this is a legit concern. One doesn't even have to cross time zones, it's enough that your own time zone switches from Winter to Summer time (that's GMT to BST, AKA +1 hour, for example) which can cause the Scheduled Tasks to effectively skip a daily or hourly task when executed the right time.
    However if you had, say a system admin, who would travel between branches, every time they would log in to Sugar in a different time zone the execution pattern of the Scheduled Tasks will change as there will be either an extra execution or a skipped one.

    My solution to this problem would be to have an effective Sugar Time Zone setting in admin where you can set your Sugar instance's TZ, taking a default of your server's Time Zone. It would make sense.

  •  I originally opened a Support Ticket for this issue. I have been told SugarCRM might be evaluating a solution to this issue.

Reply Children
No Data