Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
35ca3e7b
Unverified
Commit
35ca3e7b
authored
6 years ago
by
Erik Johnston
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #3265 from matrix-org/erikj/limit_pagination
Don't support limitless pagination
parents
ad2823ee
a17e901f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/storage/stream.py
+6
-9
6 additions, 9 deletions
synapse/storage/stream.py
with
6 additions
and
9 deletions
synapse/storage/stream.py
+
6
−
9
View file @
35ca3e7b
...
@@ -684,8 +684,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
...
@@ -684,8 +684,7 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
results to only those before
results to only those before
direction(char): Either
'
b
'
or
'
f
'
to indicate whether we are
direction(char): Either
'
b
'
or
'
f
'
to indicate whether we are
paginating forwards or backwards from `from_key`.
paginating forwards or backwards from `from_key`.
limit (int): The maximum number of events to return. Zero or less
limit (int): The maximum number of events to return.
means no limit.
event_filter (Filter|None): If provided filters the events to
event_filter (Filter|None): If provided filters the events to
those that match the filter.
those that match the filter.
...
@@ -694,6 +693,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
...
@@ -694,6 +693,9 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
as a list of _EventDictReturn and a token that points to the end
as a list of _EventDictReturn and a token that points to the end
of the result set.
of the result set.
"""
"""
assert
int
(
limit
)
>=
0
# Tokens really represent positions between elements, but we use
# Tokens really represent positions between elements, but we use
# the convention of pointing to the event before the gap. Hence
# the convention of pointing to the event before the gap. Hence
# we have a bit of asymmetry when it comes to equalities.
# we have a bit of asymmetry when it comes to equalities.
...
@@ -723,22 +725,17 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
...
@@ -723,22 +725,17 @@ class StreamWorkerStore(EventsWorkerStore, SQLBaseStore):
bounds
+=
"
AND
"
+
filter_clause
bounds
+=
"
AND
"
+
filter_clause
args
.
extend
(
filter_args
)
args
.
extend
(
filter_args
)
if
int
(
limit
)
>
0
:
args
.
append
(
int
(
limit
))
args
.
append
(
int
(
limit
))
limit_str
=
"
LIMIT ?
"
else
:
limit_str
=
""
sql
=
(
sql
=
(
"
SELECT event_id, topological_ordering, stream_ordering
"
"
SELECT event_id, topological_ordering, stream_ordering
"
"
FROM events
"
"
FROM events
"
"
WHERE outlier = ? AND room_id = ? AND %(bounds)s
"
"
WHERE outlier = ? AND room_id = ? AND %(bounds)s
"
"
ORDER BY topological_ordering %(order)s,
"
"
ORDER BY topological_ordering %(order)s,
"
"
stream_ordering %(order)s
%(limit)s
"
"
stream_ordering %(order)s
LIMIT ?
"
)
%
{
)
%
{
"
bounds
"
:
bounds
,
"
bounds
"
:
bounds
,
"
order
"
:
order
,
"
order
"
:
order
,
"
limit
"
:
limit_str
}
}
txn
.
execute
(
sql
,
args
)
txn
.
execute
(
sql
,
args
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment