Skip to content
Snippets Groups Projects
Commit cdd95fe8 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fixed invalidate for CPManager

parent 6fff94ab
No related branches found
No related tags found
No related merge requests found
# v2.21.3 # v2.21.3
* fixed invalidate for CPManager
\ No newline at end of file
__version__ = '2.21.3a1' __version__ = '2.21.3a2'
...@@ -45,7 +45,6 @@ class CPManager(Monitor, Closeable, tp.Generic[T], metaclass=abc.ABCMeta): ...@@ -45,7 +45,6 @@ class CPManager(Monitor, Closeable, tp.Generic[T], metaclass=abc.ABCMeta):
if sys.implementation.name != 'cpython': if sys.implementation.name != 'cpython':
warnings.warn(f'This may run bad on {sys.implementation.name}', RuntimeWarning) warnings.warn(f'This may run bad on {sys.implementation.name}', RuntimeWarning)
self.connections = queue.Queue(max_number) self.connections = queue.Queue(max_number)
self.spawned_connections = 0
self.max_number = max_number self.max_number = max_number
self.max_cycle_no = max_cycle_no self.max_cycle_no = max_cycle_no
self.id_to_times = {} # type: tp.Dict[int, int] self.id_to_times = {} # type: tp.Dict[int, int]
...@@ -61,9 +60,10 @@ class CPManager(Monitor, Closeable, tp.Generic[T], metaclass=abc.ABCMeta): ...@@ -61,9 +60,10 @@ class CPManager(Monitor, Closeable, tp.Generic[T], metaclass=abc.ABCMeta):
""" """
Close all connections. Connections have to be released first. Object is ready for use after this Close all connections. Connections have to be released first. Object is ready for use after this
""" """
while self.spawned_connections > 0: while self.connections.qsize() > 0:
self.teardown_connection(self.connections.get()) conn = self.connections.get()
self.spawned_connections -= 1 self.teardown_connection(conn)
del self.id_to_times[id(conn)]
def acquire_connection(self) -> T: def acquire_connection(self) -> T:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment