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

to_device updates could be dropped when consuming the replication stream #15349

Merged
merged 5 commits into from
Mar 30, 2023
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
Prev Previous commit
Next Next commit
Update synapse/storage/databases/main/deviceinbox.py
Co-authored-by: reivilibre <[email protected]>
  • Loading branch information
Mathieu Velten and reivilibre authored Mar 30, 2023
commit c59743f60da4fe226b6eaffb1fdfbefb7d0f18c4
4 changes: 1 addition & 3 deletions synapse/storage/databases/main/deviceinbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,7 @@ def get_all_new_device_messages_txn(
if len(updates) >= limit:
upto_token = updates[-1][0]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this if block makes sense any more.
We don't even limit the number of rows directly anyway.
I think upper_pos is always the right answer now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hummm I am unsure if the right answer is upper_pos or updates[-1][0].
I agree that the if seems useless however.

Using upper_pos should be fine as long as we are sure that the stream id actually exists already at this time, which should be always true I believe.

Copy link
Contributor Author

@MatMaul MatMaul Mar 30, 2023

Choose a reason for hiding this comment

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

I've used upper_pos (well, upto_token actually since I prefer this name, YMMV).
It simplifies the logic quite a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also, the comment I just added here would not be true, and should probably be removed I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also prefer upto_token; upper_pos doesn't mean anything to me :)


limited = False
if upto_token < current_id:
limited = True
limited = upto_token < current_id

return updates, upto_token, limited

Expand Down