Skip to content

Commit 7234afb

Browse files
committed
update puma config
1 parent 65089c7 commit 7234afb

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

config/puma.rb

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
1-
require "sidekiq"
1+
# frozen_string_literal: true
22

3-
max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
4-
min_threads_count = ENV.fetch("RAILS_MIN_THREADS", max_threads_count)
5-
threads min_threads_count, max_threads_count
3+
require "sidekiq"
64

7-
if ENV["RAILS_ENV"] == "production"
8-
require "concurrent-ruby"
9-
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
10-
if worker_count > 1
11-
workers worker_count
12-
end
13-
end
5+
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
6+
threads threads_count, threads_count
147

15-
if ENV.fetch("RAILS_ENV", "development") == "development"
16-
worker_timeout 3600
17-
end
18-
19-
port ENV.fetch("PORT", 3000)
20-
environment ENV.fetch("RAILS_ENV", "development")
21-
pidfile ENV.fetch("PIDFILE", "tmp/pids/server.pid")
8+
port ENV.fetch("PORT", 3000)
9+
pidfile ENV.fetch("PIDFILE", "tmp/pids/server.pid")
2210

2311
plugin :tmp_restart
2412

13+
# Recommendation from https://github.com/Shopify/autotuner
14+
before_fork do
15+
3.times { GC.start }
16+
GC.compact
17+
end
18+
2519
preload_app!
2620

2721
sidekiq = nil

0 commit comments

Comments
 (0)