Handle stopping a nil worker_thread client (#72)

approved
#1

Handle stopping a nil worker_thread client (#72)

diff --git a/lib/prometheus_exporter/client.rb b/lib/prometheus_exporter/client.rb
index 049aa2e..9fa5855 100644
--- a/lib/prometheus_exporter/client.rb
+++ b/lib/prometheus_exporter/client.rb
@@ -124,7 +124,7 @@ module PrometheusExporter
       @mutex.synchronize do
         wait_for_empty_queue_with_timeout(wait_timeout_seconds)
         @worker_thread&.kill
-        while @worker_thread.alive?
+        while @worker_thread&.alive?
           sleep 0.001
         end
         @worker_thread = nil

GitHub sha: e3c7820e

1 Like
Approved #2