Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
0f118e55
Commit
0f118e55
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Plain Diff
Merge pull request #168 from matrix-org/erikj/conn_pool
Make HTTP clients use connection pools.
parents
2f54522d
11f51e6d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/http/client.py
+5
-2
5 additions, 2 deletions
synapse/http/client.py
synapse/http/matrixfederationclient.py
+4
-2
4 additions, 2 deletions
synapse/http/matrixfederationclient.py
with
9 additions
and
4 deletions
synapse/http/client.py
+
5
−
2
View file @
0f118e55
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
synapse/http/matrixfederationclient.py
+
4
−
2
View file @
0f118e55
...
...
@@ -16,7 +16,7 @@
from
twisted.internet
import
defer
,
reactor
,
protocol
from
twisted.internet.error
import
DNSLookupError
from
twisted.web.client
import
readBody
,
_AgentBase
,
_URI
from
twisted.web.client
import
readBody
,
_AgentBase
,
_URI
,
HTTPConnectionPool
from
twisted.web.http_headers
import
Headers
from
twisted.web._newclient
import
ResponseDone
...
...
@@ -103,7 +103,9 @@ class MatrixFederationHttpClient(object):
self
.
hs
=
hs
self
.
signing_key
=
hs
.
config
.
signing_key
[
0
]
self
.
server_name
=
hs
.
hostname
self
.
agent
=
MatrixFederationHttpAgent
(
reactor
)
pool
=
HTTPConnectionPool
(
reactor
)
pool
.
maxPersistentPerHost
=
10
self
.
agent
=
MatrixFederationHttpAgent
(
reactor
,
pool
)
self
.
clock
=
hs
.
get_clock
()
self
.
version_string
=
hs
.
version_string
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment