mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
modules/client/sync: Handle timeout from acceptor dock.
This commit is contained in:
parent
a5ebd50f55
commit
18e9c792be
1 changed files with 21 additions and 2 deletions
|
@ -322,6 +322,7 @@ void
|
|||
longpoll_sync(client &client,
|
||||
const resource::request &request,
|
||||
const syncargs &args)
|
||||
try
|
||||
{
|
||||
std::unique_lock<decltype(m::vm::accept)> lock
|
||||
{
|
||||
|
@ -332,8 +333,7 @@ longpoll_sync(client &client,
|
|||
{
|
||||
auto &accepted
|
||||
{
|
||||
//m::vm::accept.wait_for(lock, milliseconds(sync_timeout_min))
|
||||
m::vm::accept.wait(lock)
|
||||
m::vm::accept.wait_until(lock, args.timesout)
|
||||
};
|
||||
|
||||
const unlock_guard<decltype(lock)> ul(lock);
|
||||
|
@ -341,6 +341,25 @@ longpoll_sync(client &client,
|
|||
return;
|
||||
}
|
||||
}
|
||||
catch(const ctx::timeout &e)
|
||||
{
|
||||
const ctx::exception_handler eh;
|
||||
|
||||
const int64_t &since
|
||||
{
|
||||
int64_t(m::vm::current_sequence)
|
||||
};
|
||||
|
||||
resource::response
|
||||
{
|
||||
client, json::members
|
||||
{
|
||||
{ "next_batch", int64_t(since) },
|
||||
{ "rooms", json::object{} },
|
||||
{ "presence", json::object{} },
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static bool
|
||||
synchronize(client &client,
|
||||
|
|
Loading…
Reference in a new issue