Only allow 1800 loops in a thread, to prevent email IMAP fetch stops working if mailserver is once unreachable. Fixes issue#1861.
This commit is contained in:
parent
15d8cb213d
commit
cc4ce92072
1 changed files with 5 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue