Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Bring the instance_map into ReplicationEndpointFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
realtyem committed May 11, 2023
1 parent e4f545c commit 5a5eb88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions synapse/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ def __init__(

self.agent: IAgent = ReplicationAgent(
hs.get_reactor(),
hs.config.worker.instance_map,
contextFactory=hs.get_http_client_context_factory(),
pool=pool,
)
Expand Down
8 changes: 6 additions & 2 deletions synapse/http/replicationagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

import logging
from typing import Optional
from typing import Any, Dict, Optional

from zope.interface import implementer

Expand Down Expand Up @@ -44,9 +44,11 @@ class ReplicationEndpointFactory:
def __init__(
self,
reactor: ISynapseReactor,
instance_map: Dict[str, Any],
context_factory: IPolicyForHTTPS,
) -> None:
self.reactor = reactor
self.instance_map = instance_map
self.context_factory = context_factory

def endpointForURI(self, uri: URI) -> IStreamClientEndpoint:
Expand Down Expand Up @@ -80,6 +82,7 @@ class ReplicationAgent(_AgentBase):
def __init__(
self,
reactor: ISynapseReactor,
instance_map: Dict[str, Any],
contextFactory: IPolicyForHTTPS,
connectTimeout: Optional[float] = None,
bindAddress: Optional[bytes] = None,
Expand All @@ -102,7 +105,8 @@ def __init__(
created.
"""
_AgentBase.__init__(self, reactor, pool)
endpoint_factory = ReplicationEndpointFactory(reactor, contextFactory)
endpoint_factory = ReplicationEndpointFactory(
reactor, instance_map, contextFactory
self._endpointFactory = endpoint_factory

def request(
Expand Down

0 comments on commit 5a5eb88

Please sign in to comment.