summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2020-07-17 07:59:23 -0400
committerGitHub <noreply@github.com>2020-07-17 07:59:23 -0400
commit852930add765540c580378238ab03869a8c7530d (patch)
tree105fc715ef41f221871a12ba22704dc1dbddc4d7 /synapse/rest
parentChange "unknown room ver" logging to warning. (#7881) (diff)
downloadsynapse-852930add765540c580378238ab03869a8c7530d.tar.xz
Add a default limit (of 100) to get/sync operations. (#7858)
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/_base.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/rest/client/v2_alpha/_base.py b/synapse/rest/client/v2_alpha/_base.py
index bc11b4dda4..b21538766d 100644
--- a/synapse/rest/client/v2_alpha/_base.py
+++ b/synapse/rest/client/v2_alpha/_base.py
@@ -22,6 +22,7 @@ from twisted.internet import defer
 
 from synapse.api.errors import InteractiveAuthIncompleteError
 from synapse.api.urls import CLIENT_API_PREFIX
+from synapse.types import JsonDict
 
 logger = logging.getLogger(__name__)
 
@@ -51,7 +52,15 @@ def client_patterns(path_regex, releases=(0,), unstable=True, v1=False):
     return patterns
 
 
-def set_timeline_upper_limit(filter_json, filter_timeline_limit):
+def set_timeline_upper_limit(filter_json: JsonDict, filter_timeline_limit: int) -> None:
+    """
+    Enforces a maximum limit of a timeline query.
+
+    Params:
+        filter_json: The timeline query to modify.
+        filter_timeline_limit: The maximum limit to allow, passing -1 will
+            disable enforcing a maximum limit.
+    """
     if filter_timeline_limit < 0:
         return  # no upper limits
     timeline = filter_json.get("room", {}).get("timeline", {})