Monitors stop themselves when the Topology is GC'ed.

This commit is contained in:
A. Jesse Jiryu Davis 2014-10-31 22:10:20 -04:00
parent 38848d47f3
commit 21976d9976
2 changed files with 6 additions and 2 deletions

View File

@ -44,7 +44,12 @@ class Monitor(object):
"""
super(Monitor, self).__init__()
self._server_description = server_description
self._topology = weakref.proxy(topology)
# A weakref callback, takes ref to the dead topology as its parameter.
def close(dummy):
self.close()
self._topology = weakref.proxy(topology, close)
self._pool = pool
self._settings = topology_settings
self._stopped = False

View File

@ -49,7 +49,6 @@ class TestMonitor(IntegrationTest):
ref = wait_until(partial(find_monitor_ref, monitor),
'register monitor')
client.close()
del monitor
del client