Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clear_active_connections! with no argument deprecation warning #217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/gruf/interceptors/active_record/connection_reset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ class ConnectionReset < ::Gruf::Interceptors::ServerInterceptor
def call
yield
ensure
target_classes.each { |klass| klass.connection_handler.clear_active_connections! } if enabled?
if enabled?
target_classes.each do |klass|
klass.connection_handler.clear_active_connections!(::ActiveRecord::Base.current_role)
end
end
end

private
Expand Down
6 changes: 5 additions & 1 deletion spec/support/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def self.connection_handler
def self.connected?
true
end

def self.current_role
:writing
end
end

class Connection
Expand All @@ -45,7 +49,7 @@ def active?
end

class ConnectionHandler
def clear_active_connections!
def clear_active_connections!(role)
true
end
end
Expand Down