mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 20:18:38 +02:00
Merge pull request #1341 from cisagov/za/fix-connection-pooling-multiple-instances
Fix connection pool issue with multiple instances
This commit is contained in:
commit
aec6d23a58
2 changed files with 6 additions and 0 deletions
|
@ -125,10 +125,14 @@ class TestConnectionPool(TestCase):
|
||||||
xml = (location).read_bytes()
|
xml = (location).read_bytes()
|
||||||
return xml
|
return xml
|
||||||
|
|
||||||
|
def do_nothing(command):
|
||||||
|
pass
|
||||||
|
|
||||||
# Mock what happens inside the "with"
|
# Mock what happens inside the "with"
|
||||||
with ExitStack() as stack:
|
with ExitStack() as stack:
|
||||||
stack.enter_context(patch.object(EPPConnectionPool, "_create_socket", self.fake_socket))
|
stack.enter_context(patch.object(EPPConnectionPool, "_create_socket", self.fake_socket))
|
||||||
stack.enter_context(patch.object(Socket, "connect", self.fake_client))
|
stack.enter_context(patch.object(Socket, "connect", self.fake_client))
|
||||||
|
stack.enter_context(patch.object(EPPConnectionPool, "kill_all_connections", do_nothing))
|
||||||
stack.enter_context(patch.object(SocketTransport, "send", self.fake_send))
|
stack.enter_context(patch.object(SocketTransport, "send", self.fake_send))
|
||||||
stack.enter_context(patch.object(SocketTransport, "receive", fake_receive))
|
stack.enter_context(patch.object(SocketTransport, "receive", fake_receive))
|
||||||
# Restart the connection pool
|
# Restart the connection pool
|
||||||
|
|
|
@ -101,6 +101,8 @@ class EPPConnectionPool(ConnectionPool):
|
||||||
gevent.killall(self.greenlets)
|
gevent.killall(self.greenlets)
|
||||||
|
|
||||||
self.greenlets.clear()
|
self.greenlets.clear()
|
||||||
|
for connection in self.conn:
|
||||||
|
connection.disconnect()
|
||||||
self.conn.clear()
|
self.conn.clear()
|
||||||
|
|
||||||
# Clear the semaphore
|
# Clear the semaphore
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue