Ruby on rails 这是heroku上unicorn的正确设置吗?

Ruby on rails 这是heroku上unicorn的正确设置吗?,ruby-on-rails,ruby,postgresql,heroku,Ruby On Rails,Ruby,Postgresql,Heroku,昨天我在heroku上遇到了一个问题,我的redis连接变得陈旧(heroku+postgres+sidekiq)。确切的错误是: Re: PG::ConnectionBad: PQconsumeInput() SSL SYSCALL error: EOF detected 我不确定这是什么意思,所以我查了一下,发现了这个问题: 我在sidekiq.rb初始值设定项中实现了以下功能: Sidekiq.configure_server do |config| pool_size = Side

昨天我在heroku上遇到了一个问题,我的redis连接变得陈旧(heroku+postgres+sidekiq)。确切的错误是:

Re: PG::ConnectionBad: PQconsumeInput() SSL SYSCALL error: EOF detected
我不确定这是什么意思,所以我查了一下,发现了这个问题:

我在sidekiq.rb初始值设定项中实现了以下功能:

Sidekiq.configure_server do |config|
  pool_size = Sidekiq.options[:concurrency] + 2

  if defined?(ActiveRecord::Base)
    config = Rails.application.config.database_configuration[Rails.env]
    config['pool'] = pool_size
    ActiveRecord::Base.establish_connection(config)
  end
end
然而,heroku告诉我错误的原因是他们自己,他们把我的DB拿下来进行维护…非常混乱

所以在阅读heroku文档时,我发现我需要这个来安装unicorn服务器:

unicorn.rb:

worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
timeout 15
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
我的问题是,这是我的系统的正确设置吗?自从我调用ActiveRecord::Base.build\u连接两次后,是否存在冲突