Module: Anycable::Rails::ActiveRecord::ReleaseConnection
- Defined in:
- lib/anycable/rails/activerecord/release_connection.rb
Overview
Release ActiveRecord connection after every call (if any)
Instance Method Summary collapse
Instance Method Details
#command ⇒ Object
16 17 18 |
# File 'lib/anycable/rails/activerecord/release_connection.rb', line 16 def command(*) wrap_release_connection { super } end |
#connect ⇒ Object
8 9 10 |
# File 'lib/anycable/rails/activerecord/release_connection.rb', line 8 def connect(*) wrap_release_connection { super } end |
#disconnect ⇒ Object
12 13 14 |
# File 'lib/anycable/rails/activerecord/release_connection.rb', line 12 def disconnect(*) wrap_release_connection { super } end |
#wrap_release_connection ⇒ Object
20 21 22 23 24 25 |
# File 'lib/anycable/rails/activerecord/release_connection.rb', line 20 def wrap_release_connection res = yield ::ActiveRecord::Base.connection_pool.release_connection if ::ActiveRecord::Base.connection_pool.active_connection? res end |