Sha256: a66dbecaa3760d57fe4561d3159b0d4c72ece3a7fca4cdc0a2c5ac2cc01de553

Contents?: true

Size: 928 Bytes

Versions: 39

Compression:

Stored size: 928 Bytes

Contents

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

worker_processes (ENV['WEB_CONCURRENCY'] || 3).to_i
timeout (ENV['WEB_TIMEOUT'] || 5).to_i
preload_app true

before_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn master intercepting TERM and 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 and doing nothing. Wait 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

39 entries across 39 versions & 2 rubygems

Version Path
jetfuel-1.19.24 templates/unicorn.rb
jetfuel-1.19.23 templates/unicorn.rb
jetfuel-1.19.22 templates/unicorn.rb
jetfuel-1.19.21 templates/unicorn.rb
jetfuel-1.19.20 templates/unicorn.rb
jetfuel-1.19.19 templates/unicorn.rb
jetfuel-1.19.18 templates/unicorn.rb
jetfuel-1.19.17 templates/unicorn.rb
jetfuel-1.19.16 templates/unicorn.rb
jetfuel-1.19.15 templates/unicorn.rb
jetfuel-1.19.14 templates/unicorn.rb
jetfuel-1.19.13 templates/unicorn.rb
jetfuel-1.19.12 templates/unicorn.rb
jetfuel-1.19.11 templates/unicorn.rb
jetfuel-1.19.10 templates/unicorn.rb
jetfuel-1.19.9 templates/unicorn.rb
jetfuel-1.19.8 templates/unicorn.rb
jetfuel-1.19.7 templates/unicorn.rb
jetfuel-1.19.6 templates/unicorn.rb
jetfuel-1.19.5 templates/unicorn.rb