mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
modules/client/sync: Add a next_batch
param to the query args passed to the range upper-bound.
This commit is contained in:
parent
0b8a2dfae4
commit
fc162b41b3
2 changed files with 13 additions and 2 deletions
|
@ -86,8 +86,7 @@ ircd::m::sync::handle_get(client &client,
|
||||||
// exist yet because it is one past the server's current_sequence counter.
|
// exist yet because it is one past the server's current_sequence counter.
|
||||||
const m::events::range range
|
const m::events::range range
|
||||||
{
|
{
|
||||||
args.since, // start at since token
|
args.since, std::min(args.next_batch, m::vm::current_sequence + 1)
|
||||||
m::vm::current_sequence + 1 // stop before future
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// When the range indexes are the same, the client is polling for the next
|
// When the range indexes are the same, the client is polling for the next
|
||||||
|
|
|
@ -101,6 +101,18 @@ struct ircd::m::sync::args
|
||||||
request.query.get<uint64_t>("since", 0)
|
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]
|
steady_point timesout{[this]
|
||||||
{
|
{
|
||||||
// 6.2.1 The maximum time to poll in milliseconds before returning this request.
|
// 6.2.1 The maximum time to poll in milliseconds before returning this request.
|
||||||
|
|
Loading…
Reference in a new issue