mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-01 17:46:04 -04:00
Add a default limit (of 100) to get/sync operations. (#7858)
This commit is contained in:
parent
4642fd66df
commit
852930add7
4 changed files with 18 additions and 4 deletions
|
@ -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", {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue