lib/rocket_job/plugins/job/worker.rb in rocketjob-5.0.0.beta4 vs lib/rocket_job/plugins/job/worker.rb in rocketjob-5.0.0.rc1
- old
+ new
@@ -59,11 +59,13 @@
end
# Requeues all jobs that were running on a server that died
def requeue_dead_server(server_name)
# Need to requeue paused, failed since user may have transitioned job before it finished
- where(:state.in => %i[running paused failed]).each do |job|
- job.requeue!(server_name) if job.may_requeue?(server_name)
+ with(read: {mode: :primary}) do |conn|
+ conn.where(:state.in => %i[running paused failed]).each do |job|
+ job.requeue!(server_name) if job.may_requeue?(server_name)
+ end
end
end
private