Skip to content

Commit

Permalink
Lock the process record before heartbeating
Browse files Browse the repository at this point in the history
To guard against race conditions of the record being deleted precisely
then.
  • Loading branch information
rosa committed Sep 9, 2024
1 parent 8744877 commit 29f297c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/solid_queue/processes/registrable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def stop_heartbeat
end

def heartbeat
process.reload.heartbeat
process.with_lock(&:heartbeat)
rescue ActiveRecord::RecordNotFound
self.process = nil
wake_up
Expand Down

0 comments on commit 29f297c

Please sign in to comment.