Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Rails.application.load_server to Demo config.ru; quiet puma web-concurrency warnings #1314

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
require_relative 'config/environment'

run Rails.application
Rails.application.load_server if Rails.application.respond_to?(:load_server)
9 changes: 5 additions & 4 deletions demo/config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY") { 0 }
web_concurrency = ENV.fetch("WEB_CONCURRENCY") { 0 }.to_i
workers web_concurrency

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
Expand All @@ -36,15 +37,15 @@

before_fork do
GoodJob.shutdown
end
end if web_concurrency > 0

on_worker_boot do
GoodJob.restart
end
end if web_concurrency > 0

on_worker_shutdown do
GoodJob.shutdown
end
end if web_concurrency > 0

MAIN_PID = Process.pid
at_exit do
Expand Down