summary refs log tree commit diff
path: root/synapse/streams/config.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-19 11:37:05 +0000
committerErik Johnston <erik@matrix.org>2016-01-19 11:37:05 +0000
commit9a8949f0221b0487e42830c57873bddae40c056a (patch)
treebc6d459a0e5ea88432af7d253daf7e0e46c1f645 /synapse/streams/config.py
parentChange default pushrules back to notifying for all messages. (diff)
parentMerge pull request #502 from matrix-org/erikj/push_notif_perf (diff)
downloadsynapse-9a8949f0221b0487e42830c57873bddae40c056a.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into default_notify
Diffstat (limited to 'synapse/streams/config.py')
-rw-r--r--synapse/streams/config.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/streams/config.py b/synapse/streams/config.py
index 8c082bf4e0..4f089bfb94 100644
--- a/synapse/streams/config.py
+++ b/synapse/streams/config.py
@@ -22,6 +22,9 @@ import logging
 logger = logging.getLogger(__name__)
 
 
+MAX_LIMIT = 1000
+
+
 class SourcePaginationConfig(object):
 
     """A configuration object which stores pagination parameters for a
@@ -32,7 +35,7 @@ class SourcePaginationConfig(object):
         self.from_key = from_key
         self.to_key = to_key
         self.direction = 'f' if direction == 'f' else 'b'
-        self.limit = int(limit) if limit is not None else None
+        self.limit = min(int(limit), MAX_LIMIT) if limit is not None else None
 
     def __repr__(self):
         return (
@@ -49,7 +52,7 @@ class PaginationConfig(object):
         self.from_token = from_token
         self.to_token = to_token
         self.direction = 'f' if direction == 'f' else 'b'
-        self.limit = int(limit) if limit is not None else None
+        self.limit = min(int(limit), MAX_LIMIT) if limit is not None else None
 
     @classmethod
     def from_request(cls, request, raise_invalid_params=True,