From 26cf849f020034fdbfc6020d3e2930103e8ece08 Mon Sep 17 00:00:00 2001 From: Guillaume Truchot Date: Thu, 12 Mar 2020 15:22:29 +0100 Subject: [PATCH] Fix out_of_band hook never executed when multiple worker threads (closes #2177) --- History.md | 1 + lib/puma/server.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index 2fab78af9a..667ff59a91 100644 --- a/History.md +++ b/History.md @@ -24,6 +24,7 @@ * Rescue IO::WaitReadable instead of EAGAIN for blocking read (#2121) * Ensure `BUNDLE_GEMFILE` is unspecified in workers if unspecified in master when using `prune_bundler` (#2154) * Rescue and log exceptions in hooks defined by users (on_worker_boot, after_worker_fork etc) (#1551) + * Fix `out_of_band` hook never executed if the number of worker threads is > 1 (#2177) * Refactor * Remove unused loader argument from Plugin initializer (#2095) diff --git a/lib/puma/server.rb b/lib/puma/server.rb index fc5e24fd55..126ca30023 100644 --- a/lib/puma/server.rb +++ b/lib/puma/server.rb @@ -291,7 +291,7 @@ def handle_servers pool << client busy_threads = pool.wait_until_not_full - if busy_threads == 0 + if busy_threads < @max_threads @options[:out_of_band].each(&:call) if @options[:out_of_band] end end