Announcement

Collapse
No announcement yet.

Irregular timing of Scheduled Tasks

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

    Irregular timing of Scheduled Tasks

    Hi folks,

    I've been testing a module that uses Scheduled Tasks, and I'm finding that Merchant's scheduling program doesn't seem to be very accurate. I set a 1-hour interval for a task and let it run for a while, and it was executed at 12:43, 1:49, 3:09, 4:25, 6:09, 7:13, 8:20, 10:49, and 12:52. Of the eight intervals, only four were less than 1hr. 10 mins.; one was over two hours, and two others were over an hour and a half. I had similar results from other tests, with different intervals, in two different stores. Is this normal?

    I don't think it could be caused by a module bug; the the actual task executions are very simple and quick. The module includes a viewer page for the ScheduledTaskLogs table, and I'm not seeing any error messages in there.

    Thanks --
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    #2
    If I recall correctly anything miva "schedules" is actually based on site activity.
    So if your site is used only occasionally, the module will run - but only as its updated by site activity.
    I regularly visited site will schedule correctly, but not a slower site.
    You need a cron job for that.

    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com

    Comment


      #3
      That's correct, you'd have to have a cron job to just hit merchant.mvc if the site doesn't receive traffic at a rate greater than the scheduled interval.
      David Hubbard
      CIO
      Miva
      [email protected]
      http://www.miva.com

      Comment


        #4
        Suppose I want to write my own "clock" program. Is there a library function that I can call that will cause the store to run any scheduled tasks that are due for execution? I looked in the LSK, but the latest version doesn't include the features/sch folder (hope that will be fixed soon?). I did find a function named ScheduledTasks_Spawn_AsynchronousTask that is called from the Store_Open function; is that the one that does what I'm looking for?

        Thanks --
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          From Dev:

          To ensure super accurate timing, you’d have to have something (like an external monitoring script, for example) that pings the site at regular intervals.
          Thanks,

          Rick Wilson
          CEO
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #6
            Yes, I suppose the simplest way to do it would be to set up a cron job that just hits a store URL at regular intervals. But one of my clients is on a Windows server, and they don't have access to server tasks. All the setup, and any changes that are needed later, has to be done by contacting the hoster, which is a nuisance during installation and testing.

            Thanks to the Miva Script "sleep" functions, it would be easy to write a small stand-alone script that would run in an infinite loop, just pinging the store and sleeping. But is it possible to set up a script to run indefinitely like that, with no browser connected?

            Thanks --
            Kent Multer
            Magic Metal Productions
            http://TheMagicM.com
            * Web developer/designer
            * E-commerce and Miva
            * Author, The Official Miva Web Scripting Book -- available on-line:
            http://www.amazon.com/exec/obidos/IS...icmetalproducA

            Comment


              #7
              That would not likely work because the application timeout, or web server connection timeout, would be reached and the script terminated. They could use a website monitoring service instead of a cron job if they don't have a way to generate regular web requests to the site and it doesn't receive enough natural traffic to generate requests on a frequent enough basis.
              David Hubbard
              CIO
              Miva
              [email protected]
              http://www.miva.com

              Comment

              Working...
              X