Skip to content

Commit

Permalink
Update ActiveRecord connection clearing and .gitignore
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bjer committed Oct 12, 2023
1 parent 6e8709f commit d4161fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ bin
coverage
pkg/*
gemfiles/**/*.gemfile.lock
.idea/
.ruby-version
2 changes: 1 addition & 1 deletion lib/delayed/backend/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d4161fd

Please sign in to comment.