MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / ResetPoolThread

Class ResetPoolThread

test/test_client.py:1779–1796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1777
1778 # Continuously reset the pool.
1779 class ResetPoolThread(threading.Thread):
1780 def __init__(self, pool):
1781 super().__init__()
1782 self.running = True
1783 self.pool = pool
1784
1785 def stop(self):
1786 self.running = False
1787
1788 def _run(self):
1789 while self.running:
1790 exc = AutoReconnect("mock pool error")
1791 ctx = _ErrorContext(exc, 0, pool.gen.get_overall(), False, None)
1792 client._topology.handle_error(pool.address, ctx)
1793 time.sleep(0.001)
1794
1795 def run(self):
1796 self._run()
1797
1798 t = ResetPoolThread(pool)
1799 t.start()

Callers 1

Calls

no outgoing calls

Tested by 1