捕获TERM并发送QUIT后,Heroku上的独角兽退出超时
我收到一个运行独角兽和sidekiq的Heroku应用程序的R12退出超时错误。每当我部署时,这些错误每天都会发生1-2次。我知道我需要转换Heroku的关闭信号以使独角兽正确响应,但我认为我已经在以下独角兽配置中这样做了: worker_processes 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. My PID is #{Process.pid}" Process.kill 'QUIT', Process.pid end if defined?(ActiveRecord::Base) ActiveRecord::Base.connection.disconnect! Rails.logger.info('Disconnected from ActiveRecord') end end after_fork do |server, worker| Signal.trap 'TERM' do puts "Unicorn worker …