Sha256: 52b6b84bf2e5f22652ddb3f44b74421d460f35d403016e7e2756f686eaa72f9b

Contents?: true

Size: 919 Bytes

Versions: 64

Compression:

Stored size: 919 Bytes

Contents

# https://devcenter.heroku.com/articles/rails-unicorn

worker_processes (ENV["UNICORN_WORKERS"] || 3).to_i
timeout (ENV["UNICORN_TIMEOUT"] || 15).to_i
preload_app true

before_fork do |_server, _worker|
  Signal.trap "TERM" do
    puts "Unicorn master intercepting TERM, sending myself QUIT instead"
    Process.kill "QUIT", Process.pid
  end

  if defined? ActiveRecord::Base
    ActiveRecord::Base.connection.disconnect!
  end
end

after_fork do |_server, _worker|
  Signal.trap "TERM" do
    puts "Unicorn worker intercepting TERM, waiting for master to send QUIT"
  end

  if defined? ActiveRecord::Base
    config = ActiveRecord::Base.configurations[Rails.env] ||
      Rails.application.config.database_configuration[Rails.env]
    config["reaping_frequency"] = (ENV["DB_REAPING_FREQUENCY"] || 10).to_i
    config["pool"] = (ENV["DB_POOL"] || 2).to_i
    ActiveRecord::Base.establish_connection(config)
  end
end

Version data entries

64 entries across 64 versions & 9 rubygems

Version Path
administrate-0.14.0 config/unicorn.rb
viniBaxterDesk-22.0.0 config/unicorn.rb
viniBaxterDesk-0.21.0 config/unicorn.rb
viniBaxterDesk-0.20.0 config/unicorn.rb
viniBaxterDesk-0.14.0 config/unicorn.rb
viniBaxterDesk-0.13.2 config/unicorn.rb
viniBaxterDesk-0.13.1 config/unicorn.rb
administrate-0.13.0 config/unicorn.rb
administrate-0.12.0 config/unicorn.rb
administrate-0.11.0 config/unicorn.rb
semantic-administrate-0.10.1 config/unicorn.rb
semantic-administrate-0.10.0 config/unicorn.rb
administrate-0.10.0 config/unicorn.rb
semantic-administrate-0.1.1 config/unicorn.rb
administrate-0.9.0 config/unicorn.rb
semantic-administrate-0.1.0 config/unicorn.rb
administrate-0.8.1 config/unicorn.rb
administrate-0.8.0 config/unicorn.rb
administrate-0.7.0 config/unicorn.rb
administrate-0.6.0 config/unicorn.rb