We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
By default, a job will overlap with itself if its execution time takes longer than the scheduled interval it runs at. For example:
SCHEDULER.every '2s' do puts "Going to bed...zzz...." sleep(6) puts "Ok I'm done" end
will print (not necessarily in the same order):
Going to bed...zzz.... Going to bed...zzz.... Going to bed...zzz.... Going to bed...zzz.... Ok I'm done Going to bed...zzz.... Ok I'm done ......
You can avoid this behaviour by passing the allow_overlapping: false argument to the SCHEDULER.
allow_overlapping: false
SCHEDULER.every '2s', allow_overlapping: false do puts "Going to bed...zzz...." sleep(6) puts "Ok I'm done" end
Problem solved!