Commit 5916c96
committed
Don't auto-create connection if nil on methods
Unless told otherwhise, when this proxy class intercepts methods, it will create
a connection if one does not already exist.
https://github.com/zendesk/active_record_host_pool/blob/v0.11.0/lib/active_record_host_pool/pool_proxy.rb#L107-L108
In Rails 5.2.0, they added the following functionality which caused issues with
code mentioned above
https://github.com/rails/rails/blob/v5.2.3/activerecord/lib/active_record/railtie.rb#L180-L195
Here's the associated PRs
rails/rails#28057
rails/rails#31221
This patch overrides the methods, retrieves the connection if it's active and
calls super without creating a new one.
This resolves an issue for applications upgrading to Rails 5.2.3 whereby
connections would be created and thrown away during Rails.application.initialize!1 parent 5d7367f commit 5916c96
1 file changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
87 | 109 | | |
88 | 110 | | |
89 | 111 | | |
| |||
0 commit comments