Ensure asyncore dispatchers are closed on exit

This commit is contained in:
Alan Boudreault 2017-06-04 11:19:31 -04:00
parent dc198f7ddb
commit 78691a7ec5
2 changed files with 10 additions and 1 deletions

View File

@ -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
======

View File

@ -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):
"""