diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2020-06-05 10:47:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-05 10:47:20 +0100 |
commit | f4e6495b5d3267976f34088fa7459b388b801eb6 (patch) | |
tree | 730d120e39ea4f9e0eb200775578777ebde3f2e8 /synapse/handlers/register.py | |
parent | Fix encryption algorithm typos in tests/comments (#7637) (diff) | |
download | synapse-f4e6495b5d3267976f34088fa7459b388b801eb6.tar.xz |
Performance improvements and refactor of Ratelimiter (#7595)
While working on https://github.com/matrix-org/synapse/issues/5665 I found myself digging into the `Ratelimiter` class and seeing that it was both: * Rather undocumented, and * causing a *lot* of config checks This PR attempts to refactor and comment the `Ratelimiter` class, as well as encourage config file accesses to only be done at instantiation. Best to be reviewed commit-by-commit.
Diffstat (limited to 'synapse/handlers/register.py')
-rw-r--r-- | synapse/handlers/register.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 55a03e53ea..cd746be7c8 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -425,14 +425,7 @@ class RegistrationHandler(BaseHandler): if not address: return - time_now = self.clock.time() - - self.ratelimiter.ratelimit( - address, - time_now_s=time_now, - rate_hz=self.hs.config.rc_registration.per_second, - burst_count=self.hs.config.rc_registration.burst_count, - ) + self.ratelimiter.ratelimit(address) def register_with_store( self, |