From d4161fd86e15edd55fdeba43f82812c74f06f379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Bj=C3=B6rkvall?= Date: Thu, 12 Oct 2023 22:34:17 +0200 Subject: [PATCH] Update ActiveRecord connection clearing and .gitignore The ActiveRecord connection clearing method is updated to use the connection_handler for improving the way connections get cleared before forking. This is more consistent with the ActiveRecord API. Two lines are also added to the .gitignore file, excluding .idea/ and .ruby-version files from version control considering the personal preferences and varying environments among developers. --- .gitignore | 2 ++ lib/delayed/backend/active_record.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fdcb09a2..00e9f91a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ bin coverage pkg/* gemfiles/**/*.gemfile.lock +.idea/ +.ruby-version diff --git a/lib/delayed/backend/active_record.rb b/lib/delayed/backend/active_record.rb index 595bdda4..2c394243 100644 --- a/lib/delayed/backend/active_record.rb +++ b/lib/delayed/backend/active_record.rb @@ -62,7 +62,7 @@ def self.ready_to_run(worker_name, max_run_time) end def self.before_fork - ::ActiveRecord::Base.clear_all_connections! + ::ActiveRecord::Base.connection_handler.clear_all_connections! end def self.after_fork