Skip to content

Commit

Permalink
Change ConnectionPool to not use an iterators for .empty! and `.c…
Browse files Browse the repository at this point in the history
…lear!` (#3021)
  • Loading branch information
jterapin committed May 13, 2024
1 parent 7090d10 commit 0466842
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions gems/aws-sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Fix `ConnectionPool` for `.empty!` and `.clear!` since it prevented adding a new key from being added to the pool (#3020).

3.196.0 (2024-05-13)
------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,7 @@ def clean!
# @return [nil]
def empty!
@pool_mutex.synchronize do
@pool.each_pair do |endpoint,sessions|
sessions.each(&:finish)
end
@pool.values.flatten.map(&:finish)
@pool.clear
end
nil
Expand Down Expand Up @@ -308,7 +306,7 @@ def start_session endpoint
# @note **Must** be called behind a `@pool_mutex` synchronize block.
def _clean
now = Aws::Util.monotonic_milliseconds
@pool.each_pair do |endpoint,sessions|
@pool.values.each do |sessions|
sessions.delete_if do |session|
if session.last_used.nil? or now - session.last_used > http_idle_timeout * 1000
session.finish
Expand Down

0 comments on commit 0466842

Please sign in to comment.