Skip to content

Commit 29f297c

Browse files
committed
Lock the process record before heartbeating
To guard against race conditions of the record being deleted precisely then.
1 parent 8744877 commit 29f297c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/solid_queue/processes/registrable.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def stop_heartbeat
5353
end
5454

5555
def heartbeat
56-
process.reload.heartbeat
56+
process.with_lock(&:heartbeat)
5757
rescue ActiveRecord::RecordNotFound
5858
self.process = nil
5959
wake_up

0 commit comments

Comments
 (0)