summary refs log tree commit diff
path: root/synapse/api/ratelimiting.py
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2020-01-22 13:48:11 +0000
committerBrendan Abolivier <babolivier@matrix.org>2020-01-22 13:48:11 +0000
commitc660962d4ddc2b6bfef7cd405e48a005786970da (patch)
tree5b72fc711ad15e7f31363e43729cd4acd852afd3 /synapse/api/ratelimiting.py
parentMerge branch 'rav/storage_provider_debug' into matrix-org-hotfixes (diff)
parentAdmin API to list, filter and sort rooms (#6720) (diff)
downloadsynapse-c660962d4ddc2b6bfef7cd405e48a005786970da.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'synapse/api/ratelimiting.py')
-rw-r--r--synapse/api/ratelimiting.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/api/ratelimiting.py b/synapse/api/ratelimiting.py

index 172841f595..7a049b3af7 100644 --- a/synapse/api/ratelimiting.py +++ b/synapse/api/ratelimiting.py
@@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import collections +from collections import OrderedDict +from typing import Any, Optional, Tuple from synapse.api.errors import LimitExceededError @@ -23,7 +24,9 @@ class Ratelimiter(object): """ def __init__(self): - self.message_counts = collections.OrderedDict() + self.message_counts = ( + OrderedDict() + ) # type: OrderedDict[Any, Tuple[float, int, Optional[float]]] def can_do_action(self, key, time_now_s, rate_hz, burst_count, update=True): """Can the entity (e.g. user or IP address) perform the action?