This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Refactor get_recent_events_for_room return type #3198
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c4af4c2
Refactor get_recent_events_for_room return type
erikjohnston 9896dab
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/fi…
erikjohnston 7ce9880
Fix up comment
erikjohnston fcf55f2
Fix returned token is no longer a tuple
erikjohnston File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,6 +359,20 @@ def f(txn): | |
|
||
@defer.inlineCallbacks | ||
def get_recent_events_for_room(self, room_id, limit, end_token): | ||
"""Get the most recent events in the room in topological ordering. | ||
|
||
Args: | ||
room_id (str) | ||
limit (int) | ||
end_token (str): The stream token representing now. | ||
|
||
Returns: | ||
Deferred[tuple[list[FrozenEvent], str]]: Returns a list of | ||
events and a token pointint to the start of the returned | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pointint |
||
events. | ||
The events returned are in ascending order. | ||
""" | ||
|
||
rows, token = yield self.get_recent_event_ids_for_room( | ||
room_id, limit, end_token, | ||
) | ||
|
@@ -372,7 +386,7 @@ def get_recent_events_for_room(self, room_id, limit, end_token): | |
|
||
self._set_before_and_after(events, rows) | ||
|
||
defer.returnValue((events, (token, end_token))) | ||
defer.returnValue((events, token)) | ||
|
||
@defer.inlineCallbacks | ||
def get_recent_event_ids_for_room(self, room_id, limit, end_token): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/
token[0]
/token
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scary that that is not picked up by a sytest :(