summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2023-05-24 15:18:02 -0400
committerPatrick Cloke <patrickc@matrix.org>2023-05-30 15:04:26 -0400
commit63723b10d7cde0c386880e83f4298ffd4dece077 (patch)
treeb2dc3b93d62c22d902fb3b09662e01e09359843b
parentReduce the size of the HTTP connection pool for non-pushers. (diff)
downloadsynapse-clokep/http-conn-pool.tar.xz
Ensure persistent connections are always used. github/clokep/http-conn-pool clokep/http-conn-pool
-rw-r--r--synapse/http/client.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index ef27dab85e..685d360f5c 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -784,6 +784,13 @@ class SimpleHttpClient(BaseHttpClient):
                 self.reactor, self._ip_allowlist, self._ip_blocklist
             )
 
+        # If no connection pool was given, create a default one.
+        #
+        # This differs from _AgentBase.__init__ by creating a HTTPConnectionPool
+        # which uses persistent connections.
+        if connection_pool is None:
+            connection_pool = HTTPConnectionPool(self.reactor)
+
         self.agent: IAgent = ProxyAgent(
             self.reactor,
             hs.get_reactor(),