diff options
author | reivilibre <38398653+reivilibre@users.noreply.github.com> | 2021-09-10 17:03:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-10 17:03:18 +0100 |
commit | 524b8ead778e51adfd6667a33f2700f8e071c256 (patch) | |
tree | b19acba4d0e2aac7bc5515f0496c8af95a972edd /synapse/api | |
parent | Fix 2 typos in docs/log_contexts.md (#10795) (diff) | |
download | synapse-524b8ead778e51adfd6667a33f2700f8e071c256.tar.xz |
Add types to synapse.util. (#10601)
Diffstat (limited to 'synapse/api')
-rw-r--r-- | synapse/api/ratelimiting.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/api/ratelimiting.py b/synapse/api/ratelimiting.py index 3e3d09bbd2..cbdd74025b 100644 --- a/synapse/api/ratelimiting.py +++ b/synapse/api/ratelimiting.py @@ -46,7 +46,7 @@ class Ratelimiter: # * How many times an action has occurred since a point in time # * The point in time # * The rate_hz of this particular entry. This can vary per request - self.actions: OrderedDict[Hashable, Tuple[float, int, float]] = OrderedDict() + self.actions: OrderedDict[Hashable, Tuple[float, float, float]] = OrderedDict() async def can_do_action( self, @@ -56,7 +56,7 @@ class Ratelimiter: burst_count: Optional[int] = None, update: bool = True, n_actions: int = 1, - _time_now_s: Optional[int] = None, + _time_now_s: Optional[float] = None, ) -> Tuple[bool, float]: """Can the entity (e.g. user or IP address) perform the action? @@ -160,7 +160,7 @@ class Ratelimiter: return allowed, time_allowed - def _prune_message_counts(self, time_now_s: int): + def _prune_message_counts(self, time_now_s: float): """Remove message count entries that have not exceeded their defined rate_hz limit @@ -188,7 +188,7 @@ class Ratelimiter: burst_count: Optional[int] = None, update: bool = True, n_actions: int = 1, - _time_now_s: Optional[int] = None, + _time_now_s: Optional[float] = None, ): """Checks if an action can be performed. If not, raises a LimitExceededError |