Skip to content

Commit

Permalink
remember to close removed connections
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Dec 15, 2023
1 parent d76c243 commit d39c26b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions vcr/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,6 @@ def add_connection_to_pool_entry(self, pool, connection):
if isinstance(connection, self._connection_class):
self._connection_pool_to_connections.setdefault(pool, set()).add(connection)

def remove_connection_to_pool_entry(self, pool, connection):
if isinstance(connection, self._connection_class):
self._connection_pool_to_connections[self._connection_class].remove(connection)

def __enter__(self):
return self

Expand All @@ -386,6 +382,7 @@ def __exit__(self, *args):
connection = pool.pool.get()
if isinstance(connection, self._connection_class):
connections.remove(connection)
connection.close()
else:
readd_connections.append(connection)
for connection in readd_connections:
Expand Down

0 comments on commit d39c26b

Please sign in to comment.