diff --git a/lib/gruf/interceptors/active_record/connection_reset.rb b/lib/gruf/interceptors/active_record/connection_reset.rb index 94d71a7..81c6f50 100644 --- a/lib/gruf/interceptors/active_record/connection_reset.rb +++ b/lib/gruf/interceptors/active_record/connection_reset.rb @@ -29,7 +29,7 @@ class ConnectionReset < ::Gruf::Interceptors::ServerInterceptor def call yield ensure - target_classes.each { |klass| klass.connection_handler.clear_active_connections! } if enabled? + target_classes.each { |klass| klass.connection_handler.clear_active_connections!(::ActiveRecord::Base.current_role) } if enabled? end private diff --git a/spec/support/rails.rb b/spec/support/rails.rb index 35c34dd..9f6b176 100644 --- a/spec/support/rails.rb +++ b/spec/support/rails.rb @@ -32,6 +32,10 @@ def self.connection_handler def self.connected? true end + + def self.current_role + :writing + end end class Connection @@ -45,7 +49,7 @@ def active? end class ConnectionHandler - def clear_active_connections! + def clear_active_connections!(role) true end end