Repeat jobs hold up other jobs
rfdonnelly opened this issue · comments
Repeat jobs head of line block the job queue until all iterations have been scheduled. See
jobrnr/lib/jobrnr/job/dispatch.rb
Line 117 in c968b4a
Instead, repeat jobs should be sent to the back of the queue after scheduling repeat job iteration. This will give other jobs a change to schedule.
diff --git a/lib/jobrnr/job/dispatch.rb b/lib/jobrnr/job/dispatch.rb
index 4042513..8e1bab7 100644
--- a/lib/jobrnr/job/dispatch.rb
+++ b/lib/jobrnr/job/dispatch.rb
@@ -110,7 +110,12 @@ module Jobrnr
slot: slot,
log: log_filename(slot)
)
- job_queue.shift if job_instance.job.state.scheduled?
+
+ if job_instance.job.state.scheduled?
+ job_queue.shift
+ else
+ job_queue.rotate!
+ end
plugins.pre_instance(Jobrnr::PreInstanceMessage.new(job_instance, options))
message(job_instance)