相关疑难解决方法(0)

使用Heroku推荐的Unicorn配置错误R12(退出超时)

我的Unicorn配置(从Heroku的文档中复制):

# config/unicorn.rb
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 30
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

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
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

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection
end
Run Code Online (Sandbox Code Playgroud)

但每次重新启动dyno时,我们都会得到:

heroku web.5 - - Error R12 (Exit timeout) -> At least one process failed to …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails heroku unicorn

22
推荐指数
2
解决办法
3325
查看次数

标签 统计

heroku ×1

ruby-on-rails ×1

unicorn ×1