verify_active_connections!在rails 4中已弃用,我们应该如何处理该功能?

Ant*_*lad 7 ruby database activerecord ruby-on-rails puma

我一直在关注这篇文章与工头设置美洲狮:

https://www.digitalocean.com/community/articles/how-to-set-up-zero-downtime-rails-deploys-using-puma-and-foreman

美洲狮脚本verify_active_connections!在连接之后说,但它在轨道4中不可用.注释掉方法调用将使脚本运行,但我不确定这是否会泄漏资源.

我能看到的关于这个问题的唯一文档是:

https://github.com/socialcast/resque-ensure-connected/issues/3

但对于该做什么没有确凿的答案.我认为选项可以省略它,rails会在引擎盖下处理它,或者每个运行的块验证每个块.有没有人真正回答该怎么做?谢谢.

Ben*_*key 1

看来在 Rails 4 中它已在此提交中删除:

https://github.com/rails/rails/commit/9d1f1b1

看来你现在应该看看:

ActiveRecord::Base.clear_active_connections!
Run Code Online (Sandbox Code Playgroud)

以下是一些讨论该问题的 github 问题线程: