0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-08 03:28:40 +02:00

modules/client/sync: Add a next_batch param to the query args passed to the range upper-bound.

This commit is contained in:
Jason Volk 2019-01-26 14:30:18 -08:00
parent 0b8a2dfae4
commit fc162b41b3
2 changed files with 13 additions and 2 deletions

View file

@ -86,8 +86,7 @@ ircd::m::sync::handle_get(client &client,
// exist yet because it is one past the server's current_sequence counter.
const m::events::range range
{
args.since, // start at since token
m::vm::current_sequence + 1 // stop before future
args.since, std::min(args.next_batch, m::vm::current_sequence + 1)
};
// When the range indexes are the same, the client is polling for the next

View file

@ -101,6 +101,18 @@ struct ircd::m::sync::args
request.query.get<uint64_t>("since", 0)
};
uint64_t next_batch
{
// [experimental] A upper bound to stop this sync at. This is used in
// conjunction with `since` to provide a stable window of results. If
// not specified the sync range is everything after `since`. NOTE that
// this DOES NOT guarantee true idempotency in all cases and for all
// time. But that would be nice. Many sync modules do not support this
// because the results of repeated calls for range may become empty
// after a while.
request.query.get<uint64_t>("next_batch", -1)
};
steady_point timesout{[this]
{
// 6.2.1 The maximum time to poll in milliseconds before returning this request.