Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Do not allow a None-limit on PaginationConfig #14146

Merged
merged 7 commits into from
Oct 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions synapse/storage/databases/main/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,8 +1200,6 @@ def _paginate_room_events_txn(
`to_token`), or `limit` is zero.
"""

assert int(limit) >= 0

Comment on lines -1203 to -1204
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded because it's enforced at construction time of a PaginationConfig?

I note that this function lets limit default to -1. Is that sensible/correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of these functions have defaults for limit (and dir) because earlier arguments also have defaults, they don't really make sense though and I'm not really sure what to do about it.

# Tokens really represent positions between elements, but we use
# the convention of pointing to the event before the gap. Hence
# we have a bit of asymmetry when it comes to equalities.
Expand Down