From 0a1a7b81772177b47a769e5ac798a1edc13528d3 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Thu, 19 Feb 2026 11:40:49 +0100 Subject: [PATCH] Handle nil process in heartbeat When a process record is pruned from the database by another supervisor, the heartbeat rescues RecordNotFound and sets process to nil to trigger re-registration. But the heartbeat timer can fire again before re-registration completes, calling heartbeat on nil. Use safe navigation to make the heartbeat a no-op when process is nil. Fixes #693 Co-Authored-By: Claude Opus 4.6 --- lib/solid_queue/processes/registrable.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/solid_queue/processes/registrable.rb b/lib/solid_queue/processes/registrable.rb index c7428010..cd7769da 100644 --- a/lib/solid_queue/processes/registrable.rb +++ b/lib/solid_queue/processes/registrable.rb @@ -54,7 +54,7 @@ def stop_heartbeat end def heartbeat - process.heartbeat + process&.heartbeat rescue ActiveRecord::RecordNotFound self.process = nil wake_up