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

Unclear how to determine boundaries of backlog in /sync API? #2849

Closed
joepie91 opened this issue Nov 4, 2020 · 5 comments
Closed

Unclear how to determine boundaries of backlog in /sync API? #2849

joepie91 opened this issue Nov 4, 2020 · 5 comments

Comments

@joepie91
Copy link

joepie91 commented Nov 4, 2020

When using /sync, it's possible to receive a limited response with a prev_batch token, which can be used with /messages to fetch the omitted backlog. So far, so good.

However, how do I know whether I've reached the end of that omitted backlog?

For example: say that I do a sync "since A", and I receive a limited response of D,E,F, so B and C are omitted. When following the included continuation token, how do I know that I've received C and B, therefore reached the end of that backlog, and there's nothing more to obtain - so that I don't duplicate processing of event A?

I've been unable to find a clear answer to this in the spec, and asking in #matrix-dev also yielded no answers.

@florianjacob
Copy link
Contributor

@richvdh
Copy link
Member

richvdh commented Mar 17, 2021

For example: say that I do a sync "since A", and I receive a limited response of D,E,F, so B and C are omitted. When following the included continuation token, how do I know that I've received C and B, therefore reached the end of that backlog, and there's nothing more to obtain - so that I don't duplicate processing of event A?

In this example, there are two /sync requests: the first returned events up to A, and a next_batch token: let's call it α. Then, you call /sync again with since=α, and it returns events=[D,E,F], limited=true, prev_batch=φ, next_batch=β.

You are looking to fill the gap between α and φ. To do so, you can call /messages with from=α, to=φ, dir=f (or vice-versa with dir=b, to go in the opposite direction); you may need to call it repeatedly with different from values to cover the whole gap.

I think you know this though, because you've implied you've tried it at #2251 (comment). So, is this just a duplicate of #2251?

@Dominaezzz
Copy link
Contributor

The spec doesn't support passing sync tokens into /messages.

@richvdh
Copy link
Member

richvdh commented Mar 18, 2021

The spec doesn't support passing sync tokens into /messages.

True. That's #2420.

@richvdh
Copy link
Member

richvdh commented Feb 28, 2022

I can't understand why this isn't a duplicate of #2251.

@richvdh richvdh closed this as completed Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants