Class: Gruf::Hooks::ActiveRecord::ConnectionReset
- Defined in:
- lib/gruf/hooks/active_record/connection_reset.rb
Overview
Resets the ActiveRecord connection to maintain accurate connected state in the thread pool
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#after(_success, _response, _call_signature, _request, _call) ⇒ Object
Reset any ActiveRecord connections after a gRPC service is called.
Methods inherited from Base
#initialize, #method_key, #service_key, #setup
Methods included from Loggable
Constructor Details
This class inherits a constructor from Gruf::Hooks::Base
Instance Method Details
#after(_success, _response, _call_signature, _request, _call) ⇒ Object
Reset any ActiveRecord connections after a gRPC service is called. Because of the way gRPC manages its connection pool, we need to ensure that this is done to properly
the call itself
35 36 37 |
# File 'lib/gruf/hooks/active_record/connection_reset.rb', line 35 def after(_success, _response, _call_signature, _request, _call) ::ActiveRecord::Base.clear_active_connections! if enabled? end |