rubyrufus-scheduler

What's difference between EveryJob and IntervalJob in rufus-scheduler gem?


I think EveryJob with option overlap: false is IntervalJob. Am I right?


Solution

  • No.

    From the documentation:

    Whereas "every" jobs are like "every 10 minutes, do this", interval jobs are like "do that, then wait for 10 minutes, then do that again, and so on"

    And about overlap: false:

    Since, by default, jobs are triggered in their own new thread, job instances might overlap. For example, a job that takes 10 minutes and is scheduled every 7 minutes will have overlaps.

    To prevent overlap, one can set :overlap => false. Such a job will not trigger if one of its instance is already running.

    The :overlap option is considered after the :mutex option when the scheduler is reviewing jobs for triggering.

    With IntervalJob, the time delta is between the last trigger end and the next trigger start point. With EveryJob, the time delta is between the trigger start points.

    If an EveryJob has overlap: false, it will not trigger while a trigger "session" is still going on.

    https://github.com/jmettraux/rufus-scheduler#rufus-scheduler