-
Notifications
You must be signed in to change notification settings - Fork 16
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
Create a method to get changes until hasMoreChanges is false #45
Comments
We need to make multiple requests until hasMoreChanges is false. |
If each request holds 100 results but there is 1000 changes would it be acceptable to return only the last? |
I'm asking a question cause I'm waiting for more clarification or an answer. |
See it as batches. Let's retake Benoit example and detail a bit more. Let's say user did not use his working laptop for a while, and then he comes back to it and refresh it. The webclient will ask for the changes. Let's say your state locally is 0.Let's say a 1000 changes occured, so the state on the server is 1000. But we limit the number of changes per request to 100 per call (supplied by the client or limited by the server). When you call /changes with sinceState 0, and maybe server limited to 100 the number of max changes returned... You will get the first 100 changes, with a hasMoreChanges to true and a new state to 100. Then you call /changes again, with since state 100, you will get next batch of changes, new state 200, hasMoreChanges still true... Then you keep calling until hasMoreChanges is false and you reach the server state 1000 which is equal to the latest state on the server.
Once again you are a client, you do not know if the server puts a limit or not to max number of changes, thus the parameter hasMoreChanges in the response. Allows to make batches. Too many changes can make a response too heavy maybe, or subject to losses over the network... I'm not sure but there must be good reasons like this. Thus the batching strategy. Is it clearer @oubchid ? :) |
Maybe let's retake the basics.
The way this flood control works is to have the client explicitly specifying the amount of data he wishes to receive (https://jmap.io/spec-core.html#changes)
So here the question might be: Say we request 128 changes, if there's more changes maybe we can just go with a We can batch updates but IMO it should be reasonably low. (No more than 512?) James BTW applies the the limit from the client without restriction.
Because a server MIGHT return recent results first (and manage intermediate states) - not implemented in James. Also smaller batch might give an impression of interactivity - but it is not doable if hidden in the jmap-client-ts.
We likely should not care about getting changes until hasMoreChanges is false. We should ask James upfront for the count of changes we want (say 512). If exceeded we do a full resynch (getAllMailboxes) |
More clear now :) |
@oubchid I did edit my comment. |
As a library user (eg: OpenPaas)
I want to get all the Mailbox changes using only one method
So that I do not have to worry about the hasMoreChanges mechanic which will be handled by the library
When I get all the changes
And the response property
hasMoreChanges
isfalse
Then the behaviour is the same than
mailbox_changes
When I get all the changes
And the response property
hasMoreChanges
istrue
Then more requests are made and merged until
hasMoreChanges
isfalse
And the client should get a response like if it was done in one request (but it will take more time)
Merging responses would be:
The text was updated successfully, but these errors were encountered: