diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 05fb7c2..900e234 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,4 +1,6 @@ #### Unreleased +* Don't use a shared closure for each spawned thread + > awilfox: https://github.com/okcomputer-ruby/okcomputer/pull/27 * Add SolidQueue checks: `SolidQueueCheck` (liveness + job stats), `SolidQueueBackedUpCheck` (per-queue backlog), `SolidQueueFailedJobsCheck` (total failed jobs), `SolidQueueFailedJobsRateCheck` (rapid increase in diff --git a/lib/ok_computer/check_collection.rb b/lib/ok_computer/check_collection.rb index 21d403f..4073733 100644 --- a/lib/ok_computer/check_collection.rb +++ b/lib/ok_computer/check_collection.rb @@ -113,10 +113,7 @@ def check_in_sequence end def check_in_parallel - threads = checks.map do |check| - Thread.new { check.run } - end - threads.each(&:join) + checks.map{ |check| Thread.new(check, &:run) }.each(&:join) end end end