File tree 1 file changed +12
-18
lines changed
1 file changed +12
-18
lines changed Original file line number Diff line number Diff line change 1
- require "sidekiq"
1
+ # frozen_string_literal: true
2
2
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"
6
4
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
14
7
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" )
22
10
23
11
plugin :tmp_restart
24
12
13
+ # Recommendation from https://github.com/Shopify/autotuner
14
+ before_fork do
15
+ 3 . times { GC . start }
16
+ GC . compact
17
+ end
18
+
25
19
preload_app!
26
20
27
21
sidekiq = nil
You can’t perform that action at this time.
0 commit comments