Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batching receipts should be per room/thread, not just per room #1684

Closed
andybalaam opened this issue Nov 30, 2023 · 4 comments · Fixed by #1685
Closed

Batching receipts should be per room/thread, not just per room #1684

andybalaam opened this issue Nov 30, 2023 · 4 comments · Fixed by #1685
Labels
A-Client-Server Issues affecting the CS API clarification An area where the expected behaviour is understood, but the spec could do with being more explicit

Comments

@andybalaam
Copy link
Contributor

andybalaam commented Nov 30, 2023

Link to problem area: https://github.com/matrix-org/matrix-spec/blob/main/content/client-server-api/modules/receipts.md?plain=1#L211

Issue
What is wrong?

In "Server behaviour" under "Receipts" we say:

For efficiency, receipts SHOULD be batched into one event per room
before delivering them to clients.

However, if a user is sending receipts for multiple threads in the same room simultaneously, this batching would prevent sending some of those receipts.

Ideally, the format would not be:

room_id: receipt_type: user_id: info_including_thread_id

but something like:

room_id: thread_id: receipt_type: user_id: info

But it's probably too late for that.

Expected behaviour

So instead I suggest rewording the above sentence to something like:

For efficiency, receipts SHOULD be batched into one event per room /thread
before delivering them to clients.

I haven't been able to verify server behaviour in this situation, but maybe a server dev could comment - do we actually lose receipts in this circumstance at the moment?

@andybalaam andybalaam added the spec-bug Something which is in the spec, but is wrong label Nov 30, 2023
@turt2live
Copy link
Member

From memory, Synapse doesn't batch read receipts - the SHOULD in the spec makes this legal behaviour.

The added /thread text (maybe saying and thread instead?) sounds good as a clarification to me.

@turt2live turt2live added clarification An area where the expected behaviour is understood, but the spec could do with being more explicit A-Client-Server Issues affecting the CS API and removed spec-bug Something which is in the spec, but is wrong labels Nov 30, 2023
@richvdh
Copy link
Member

richvdh commented Dec 5, 2023

@richvdh
Copy link
Member

richvdh commented Dec 5, 2023

I guess this was missed when MSC3771 added threaded RRs

@kegsay
Copy link
Member

kegsay commented Feb 16, 2024

From memory, Synapse doesn't batch read receipts - the SHOULD in the spec makes this legal behaviour.

It does batch read receipts, and it batches them incorrectly. Here's a test which demonstrates this matrix-org/complement#709 - Synapse source: https://github.com/element-hq/synapse/blob/v1.101.0/synapse/storage/databases/main/receipts.py#L463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Client-Server Issues affecting the CS API clarification An area where the expected behaviour is understood, but the spec could do with being more explicit
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants