Ensure asyncore dispatchers are closed on exit
This commit is contained in:
parent
dc198f7ddb
commit
78691a7ec5
|
@ -4,6 +4,7 @@
|
|||
Bug Fixes
|
||||
---------
|
||||
* is_idempotent flag is not propagated from PreparedStatement to BoundStatement (PYTHON-736)
|
||||
* Fix asyncore hang on exit (PYTHON-767)
|
||||
|
||||
3.10.0
|
||||
======
|
||||
|
|
|
@ -240,6 +240,8 @@ class AsyncoreLoop(object):
|
|||
self._timers.add_timer(timer)
|
||||
|
||||
def _cleanup(self):
|
||||
global _dispatcher_map
|
||||
|
||||
self._shutdown = True
|
||||
if not self._thread:
|
||||
return
|
||||
|
@ -253,6 +255,12 @@ class AsyncoreLoop(object):
|
|||
|
||||
log.debug("Event loop thread was joined")
|
||||
|
||||
# Ensure all connections are closed and in-flight requests cancelled
|
||||
for conn in tuple(_dispatcher_map.values()):
|
||||
conn.close()
|
||||
|
||||
log.debug("Dispatchers were closed")
|
||||
|
||||
|
||||
class AsyncoreConnection(Connection, asyncore.dispatcher):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue