From 994f003b5f9a7d74930779160876974020009e76 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Thu, 29 Jun 2023 03:14:32 +0200 Subject: [PATCH] Silence warning about unused callbacks The callbacks aren't used in cluster mode, and puma prints a warning about that. This is fine, we don't need the callbacks in single-mode, but can still keep it, in case somebody switches on cluster mode. The problem is, the current puma version has a bug, where pumactl crashes when trying to print these warnings, so lets just silence the warnings. People running in single mode also don't need to care about the warnings anyway. --- config/puma.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/puma.rb b/config/puma.rb index a11c0c0f1..5b765bd2f 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -25,6 +25,13 @@ workers 0 preload_app! +# Below callbacks (before_fork and on_worker_boot) are only used when running +# in cluster mode. Since we're not running in cluster mode by default (see +# workers above), a warning is written on startup about them not being called +# in single mode. So lets just silence that warnings, but still keep the +# callbacks in place in case somebody switches on the cluster mode. +silence_fork_callback_warning + before_fork do # we're preloading app in production, so force-reconenct the DB ActiveRecord::Base.connection_pool.disconnect!