Announcement

Collapse
No announcement yet.

Scheduled tasks - times change

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Scheduled tasks - times change

    Looks like our scheduled tasks all shifted back by 1 hour (for example if they were scheduled to start at 8 PM, now they are scheduled for 7 PM). I'm guessing it's related to the clock change - I would have expected them to stay at 8 PM though - maybe this can be a setting we can toggle in the future?

    Also I've always noticed that scheduled tasks creep forward a little bit every time they run. For example if scheduled at 8 PM and they finish at 8:01 PM, the next run will be scheduled for 8:01 PM. Looks like it re-sets the next run time after each run, based on whatever the schedule rules are. Maybe that can be toggled as well at some point?
    Looking for work as of March 2024! I've been a web developer for going on 20 years, with most of that time spent on Miva sites.

    #2
    I can't answer the clock change, but here's my take on the rest.

    Scheduled Tasks won't work as a cron job works. The cron job runs at it's scheduled time on the server with the crontab daemon maintaining the schedule and firing the script. A Miva scheduled task is triggered by traffic to the site. Basically, whatever is triggering your task needs a traffic event to start your scheduled task. Therefore, when you need something precise, I think you'd need to use a cron job.

    FWIW

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    Comment


      #3
      Scott is correct, the tasks are reliant on the site being accessed for the software to realize work is to be done. That can cause drift on a store with lower traffic. What usually causes drift though is simply the fact that Miva Merchant Scheduled Tasks are not specified as being run at specific times, they're set to run in minute, hour, or day intervals, and you simply supply a starting time. If you add a one day task and set the first occurrence at 8pm, but the next request to the site is 8:03p, that first instance is going to occur at 8:03p, and the next instance will not run before that on the following day because it would not have been a full 24 hours yet. On the next day, if the first hit on or after 8:03p occurs at 8:06p, then the job will end up drifting by three more minutes on that day.

      For tasks that are time sensitive and business critical, the built-in scheduled tasks functionality may not be sufficient. The new API, or a cron job combined with custom settings in the store, would be better for that scenario.
      David Hubbard
      CIO
      Miva
      [email protected]
      http://www.miva.com

      Comment


        #4
        What about setting a CRON just to connect to the storefront at say 12:00 PM, 1:00 AM, 2:00 AM, etc so that maintenance tasks can fire reliably and still provide you with controls inside the admin?
        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          That would not work reliably for the same reason. If the job takes even one second to complete, then the next permitted occurrence would be the scheduled interval amount past the completion time, and the cron job would come one second or more before the next occurrence is allowed to execute. If exact time is not required, but perhaps being within a five or ten minute range were okay, a cron job hitting the store every so often would work, but it still wouldn't stop the starting time drift of the task. I'll talk to our CTO about a concept of an allowed to occur within window and see if that's a possibility; we can never ensure jobs run at an exact time, but it would probably be possible to ensure a time sensitive job runs roughly the same time each day if the store sees traffic.
          David Hubbard
          CIO
          Miva
          [email protected]
          http://www.miva.com

          Comment


            #6
            Mike, check for other tasks set to start at the same time. It may be that the feature to keep tasks from executing in parallel is delaying one and pushing it forward. You may be able to lessen this by staggering their times.
            David Hubbard
            CIO
            Miva
            [email protected]
            http://www.miva.com

            Comment


              #7
              Thanks for all of the info - yes that's definitely happening with us, I have a bunch of tasks that do roughly the same thing (import tracking numbers from various flat files) all set to run at the same time.

              It's not a big deal that they drift a little, I just figured I'd mention it here while discussing the clock change thing. Overall I think the scheduled tasks are great
              Looking for work as of March 2024! I've been a web developer for going on 20 years, with most of that time spent on Miva sites.

              Comment

              Working...
              X