diff options
author | Erik Johnston <erik@matrix.org> | 2015-05-28 15:41:50 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-05-28 15:43:21 +0100 |
commit | 086df807905178c0a9de8de61e50c31354c46bc3 (patch) | |
tree | 6d14f05ee919d464bd9c89820281853506a9fd34 /synapse/http/client.py | |
parent | Use connection pool for federation connections (diff) | |
download | synapse-086df807905178c0a9de8de61e50c31354c46bc3.tar.xz |
Add connection pooling to SimpleHttpClient
Diffstat (limited to '')
-rw-r--r-- | synapse/http/client.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/http/client.py b/synapse/http/client.py index 5b3cefb2dc..9c7fa29369 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,8 @@ 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) + self.agent = Agent(reactor, pool) self.version_string = hs.version_string def request(self, method, *args, **kwargs): |