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

Deprecation warning Rails 7.1 #218

Merged
merged 2 commits into from
Oct 13, 2023
Merged

Deprecation warning Rails 7.1 #218

merged 2 commits into from
Oct 13, 2023

Conversation

bjer
Copy link
Contributor

@bjer bjer commented Oct 12, 2023

Fixes deprecation warning in active_record.rb

 DEPRECATION WARNING: Calling `ActiveRecord::Base.clear_all_connections! is deprecated. 
Please call the method directly on the connection handler; for example: 
`ActiveRecord::Base.connection_handler.clear_all_connections!`. 
(called from before_fork at .rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/bundler/gems/delayed_job_active_record-6e8709f887fa/lib/delayed/backend/active_record.rb:65)
 (ActiveSupport::DeprecationException)

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 Outdated
Comment on lines 9 to 10
.idea/
.ruby-version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are specific to your environment and do not belong in the gem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll remove that

@@ -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!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it should work for as far back as we support.

@albus522 albus522 merged commit f0048d5 into collectiveidea:master Oct 13, 2023
89 of 102 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants