Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Bump connection_pool from 2.3.0 to 2.4.0 (mastodon#24290)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claire <[email protected]>
  • Loading branch information
dependabot[bot] and ClearlyClaire authored Apr 30, 2023
1 parent 819daeb commit fa14976
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/lib/connection_pool/shared_connection_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ def checkout(preferred_tag, options = {})
end

def checkin(preferred_tag)
if ::Thread.current[key(preferred_tag)]
if preferred_tag.is_a?(Hash) && preferred_tag[:force]
# ConnectionPool 2.4+ calls `checkin(force: true)` after fork.
# When this happens, we should remove all connections from Thread.current

::Thread.current.keys.each do |name| # rubocop:disable Style/HashEachMethods
next unless name.to_s.start_with?("#{@key}-")

@available.push(::Thread.current[name])
::Thread.current[name] = nil
end
elsif ::Thread.current[key(preferred_tag)]
if ::Thread.current[key_count(preferred_tag)] == 1
@available.push(::Thread.current[key(preferred_tag)])
::Thread.current[key(preferred_tag)] = nil
Expand Down

0 comments on commit fa14976

Please sign in to comment.