From 5d53d7122130a2fea6c9ed6cef1241fb612ac751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Tue, 18 Feb 2025 11:34:34 +0100 Subject: [PATCH] DEV: Prevent deprecation warning when using Rails 7.1 --- CHANGELOG | 6 ++++++ lib/message_bus/rack/middleware.rb | 6 +++++- lib/message_bus/version.rb | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0a7437c2..85ce710a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +18-02-2025 + +- Version 4.3.9 + + - Prevent deprecation warning when using Rails 7.1 + 14-09-2023 - Version 4.3.8 diff --git a/lib/message_bus/rack/middleware.rb b/lib/message_bus/rack/middleware.rb index d6b77ba5..0858b62a 100644 --- a/lib/message_bus/rack/middleware.rb +++ b/lib/message_bus/rack/middleware.rb @@ -200,7 +200,11 @@ def close_db_connection! # this means connections are not returned until rack.async is # closed if defined? ActiveRecord::Base.connection_handler - ActiveRecord::Base.connection_handler.clear_active_connections! + if Gem::Version.new(Rails.version) >= "7.1" + ActiveRecord::Base.connection_handler.clear_active_connections!(:all) + else + ActiveRecord::Base.connection_handler.clear_active_connections! + end elsif defined? ActiveRecord::Base.clear_active_connections! ActiveRecord::Base.clear_active_connections! end diff --git a/lib/message_bus/version.rb b/lib/message_bus/version.rb index 4c894cd8..6262c7c0 100644 --- a/lib/message_bus/version.rb +++ b/lib/message_bus/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module MessageBus - VERSION = "4.3.8" + VERSION = "4.3.9" end