Skip to content

Commit fc08656

Browse files
committed
Try another workaround to avoid deadlock when dispatching scheduled jobs
Instead of deleting these using the index on `job_id`, do the DELETE relying on the primary key.
1 parent 53b6189 commit fc08656

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

app/models/solid_queue/execution/dispatching.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ def dispatch_jobs(job_ids)
1010
jobs = Job.where(id: job_ids)
1111

1212
Job.dispatch_all(jobs).map(&:id).then do |dispatched_job_ids|
13-
if dispatched_job_ids.none? then 0
14-
else
15-
where(job_id: dispatched_job_ids).order(:job_id).delete_all
16-
end
13+
where(id: where(job_id: dispatched_job_ids).pluck(:id)).delete_all
1714
end
1815
end
1916
end

0 commit comments

Comments
 (0)