summary refs log tree commit diff
path: root/synapse/server.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-09-18 10:50:04 +0100
committerErik Johnston <erik@matrix.org>2020-09-18 10:50:04 +0100
commit5e42e61609d2eb35092e31bfc9a0ded9b67f3510 (patch)
tree8fa9ea6966cfdc76bd47ae9af0a0ebc8e18dd87e /synapse/server.py
parentMove lint dependencies to extras_require (#8330) (diff)
parentFix ratelimiting for federation `/send` requests. (#8342) (diff)
downloadsynapse-5e42e61609d2eb35092e31bfc9a0ded9b67f3510.tar.xz
Merge remote-tracking branch 'origin/release-v1.20.0' into develop
Diffstat (limited to 'synapse/server.py')
-rw-r--r--synapse/server.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/server.py b/synapse/server.py
index 9055b97ac3..5e3752c333 100644
--- a/synapse/server.py
+++ b/synapse/server.py
@@ -114,6 +114,7 @@ from synapse.streams.events import EventSources
 from synapse.types import DomainSpecificString
 from synapse.util import Clock
 from synapse.util.distributor import Distributor
+from synapse.util.ratelimitutils import FederationRateLimiter
 from synapse.util.stringutils import random_string
 
 logger = logging.getLogger(__name__)
@@ -642,6 +643,10 @@ class HomeServer(metaclass=abc.ABCMeta):
     def get_replication_streams(self) -> Dict[str, Stream]:
         return {stream.NAME: stream(self) for stream in STREAMS_MAP.values()}
 
+    @cache_in_self
+    def get_federation_ratelimiter(self) -> FederationRateLimiter:
+        return FederationRateLimiter(self.clock, config=self.config.rc_federation)
+
     async def remove_pusher(self, app_id: str, push_key: str, user_id: str):
         return await self.get_pusherpool().remove_pusher(app_id, push_key, user_id)