mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 13:06:01 -04:00
Configurable maximum number of events requested by /sync and /messages (#2220)
Set the limit on the returned events in the timeline in the get and sync operations. The default value is -1, means no upper limit. For example, using `filter_timeline_limit: 5000`: POST /_matrix/client/r0/user/user:id/filter { room: { timeline: { limit: 1000000000000000000 } } } GET /_matrix/client/r0/user/user:id/filter/filter:id { room: { timeline: { limit: 5000 } } } The server cuts down the room.timeline.limit.
This commit is contained in:
parent
29ded770b1
commit
9da4316ca5
4 changed files with 21 additions and 0 deletions
|
@ -47,3 +47,11 @@ def client_v2_patterns(path_regex, releases=(0,),
|
|||
new_prefix = CLIENT_V2_ALPHA_PREFIX.replace("/v2_alpha", "/r%d" % release)
|
||||
patterns.append(re.compile("^" + new_prefix + path_regex))
|
||||
return patterns
|
||||
|
||||
|
||||
def set_timeline_upper_limit(filter_json, filter_timeline_limit):
|
||||
if filter_timeline_limit < 0:
|
||||
return # no upper limits
|
||||
if 'room' in filter_json and 'limit' in filter_json['room']:
|
||||
filter_json['room']["limit"] = min(filter_json['room']["limit"],
|
||||
filter_timeline_limit)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue