diff --git a/app/models/scheduler.rb b/app/models/scheduler.rb index 5aa54e7ca..d5c0f079b 100644 --- a/app/models/scheduler.rb +++ b/app/models/scheduler.rb @@ -233,7 +233,9 @@ class Scheduler < ApplicationModel # start loop for periods equal or under 5 minutes if job.period && job.period <= 5.minutes + loop_count = 0 loop do + loop_count += 1 _start_job(job) job = Scheduler.lookup(id: job.id) @@ -246,6 +248,9 @@ class Scheduler < ApplicationModel # exit if there is no loop period defined break if !job.period + # only do a certain amount of loops in this thread + break if loop_count == 1800 + # wait until next run sleep job.period end