summary refs log tree commit diff
path: root/synapse/replication/http/_base.py
diff options
context:
space:
mode:
authorJonathan de Jong <jonathan@automatia.nl>2021-03-08 20:00:07 +0100
committerGitHub <noreply@github.com>2021-03-08 14:00:07 -0500
commitd6196efafcc312472464c882ab630bc3fbf7bd37 (patch)
tree661bc8b15d55f2f04776a2ea23e773e1506d6ee7 /synapse/replication/http/_base.py
parentWarn that /register will soon require a type when called with an access token... (diff)
downloadsynapse-d6196efafcc312472464c882ab630bc3fbf7bd37.tar.xz
Add ResponseCache tests. (#9458)
Diffstat (limited to 'synapse/replication/http/_base.py')
-rw-r--r--synapse/replication/http/_base.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/replication/http/_base.py b/synapse/replication/http/_base.py

index 8a3f113e76..b7aa0c280f 100644 --- a/synapse/replication/http/_base.py +++ b/synapse/replication/http/_base.py
@@ -18,7 +18,7 @@ import logging import re import urllib from inspect import signature -from typing import Dict, List, Tuple +from typing import TYPE_CHECKING, Dict, List, Tuple from prometheus_client import Counter, Gauge @@ -28,6 +28,9 @@ from synapse.logging.opentracing import inject_active_span_byte_dict, trace from synapse.util.caches.response_cache import ResponseCache from synapse.util.stringutils import random_string +if TYPE_CHECKING: + from synapse.server import HomeServer + logger = logging.getLogger(__name__) _pending_outgoing_requests = Gauge( @@ -88,10 +91,10 @@ class ReplicationEndpoint(metaclass=abc.ABCMeta): CACHE = True RETRY_ON_TIMEOUT = True - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): if self.CACHE: self.response_cache = ResponseCache( - hs, "repl." + self.NAME, timeout_ms=30 * 60 * 1000 + hs.get_clock(), "repl." + self.NAME, timeout_ms=30 * 60 * 1000 ) # type: ResponseCache[str] # We reserve `instance_name` as a parameter to sending requests, so we