summary refs log tree commit diff
path: root/synapse/http/client.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-28 16:03:56 +0100
committerErik Johnston <erik@matrix.org>2015-05-28 16:03:56 +0100
commit0f118e55db81dd35193e4c100a6a1a43dd84fd61 (patch)
tree4464089d80ce51f2bb62d595639f748afaf0c310 /synapse/http/client.py
parentMerge pull request #167 from matrix-org/erikj/deep_copy_removal (diff)
parentUp maxPersistentPerHost count (diff)
downloadsynapse-0f118e55db81dd35193e4c100a6a1a43dd84fd61.tar.xz
Merge pull request #168 from matrix-org/erikj/conn_pool
Make HTTP clients use connection pools.
Diffstat (limited to 'synapse/http/client.py')
-rw-r--r--synapse/http/client.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py
index 5b3cefb2dc..8d6e89d6e7 100644
--- a/synapse/http/client.py
+++ b/synapse/http/client.py
@@ -20,7 +20,8 @@ import synapse.metrics
 
 from twisted.internet import defer, reactor
 from twisted.web.client import (
-    Agent, readBody, FileBodyProducer, PartialDownloadError
+    Agent, readBody, FileBodyProducer, PartialDownloadError,
+    HTTPConnectionPool,
 )
 from twisted.web.http_headers import Headers
 
@@ -55,7 +56,9 @@ class SimpleHttpClient(object):
         # The default context factory in Twisted 14.0.0 (which we require) is
         # BrowserLikePolicyForHTTPS which will do regular cert validation
         # 'like a browser'
-        self.agent = Agent(reactor)
+        pool = HTTPConnectionPool(reactor)
+        pool.maxPersistentPerHost = 10
+        self.agent = Agent(reactor, pool)
         self.version_string = hs.version_string
 
     def request(self, method, *args, **kwargs):