我正在使用带有Rails 4.1.1和
Ruby 2.1.1的heroku.我正在使用heroku的默认数据库配置.这就是我将database.yml放入.gitignore并且我没有使用database.yml进行生产的原因.
我面临着PG :: ConnectionBad的问题:PQsocket()无法获取套接字描述符,为了解决这个错误我需要设置reaping_frequency.
The
reaping_frequency
can tell Active Record to check to see if connections are hung or dead every N seconds and terminate them. While it is likely that over time your application may have a few connections that hang,if something in your code is causing hung connections,the reaper will not be a permanent fix to the problem.
现在我想将此配置添加到database.yml中.
reaping_frequency: 10
所以我应该直接在database.yml上添加此配置以进行覆盖,还是有其他更好的方法将此频率设置为heroku?
提前感谢您的建议.
在配置中的config / unicorn.rb或config / puma.rb中设置池和reaping_frequency:
config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env] config['pool'] = ENV['DB_POOL'] || 5 config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds ActiveRecord::Base.establish_connection(config)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。