Skip to content

Commit ca399d9

Browse files
jnunemakerclaude
andcommitted
Fix poller thread cleanup for test stability
Move thread join into reset (test-only path) so stop stays fire-and-forget in production. Suppress report_on_exception to avoid spurious stderr output when threads are killed mid-request. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 080c62b commit ca399d9

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/flipper/poller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def self.get(key, options = {})
1818
end
1919

2020
def self.reset
21-
instances.each {|_, instance| instance.stop }.clear
21+
instances.each do |_, instance|
22+
instance.stop
23+
instance.thread&.join(1)
24+
end.clear
2225
end
2326

2427
MINIMUM_POLL_INTERVAL = 10
@@ -116,6 +119,7 @@ def ensure_worker_running
116119
begin
117120
return if thread_alive?
118121
@thread = Thread.new { run }
122+
@thread&.report_on_exception = false
119123
@instrumenter.instrument("poller.#{InstrumentationNamespace}", {
120124
operation: :thread_start,
121125
})

0 commit comments

Comments
 (0)