mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Add workaround for duplicate syncs
This commit is contained in:
parent
720bb164f7
commit
12090c0a06
1 changed files with 8 additions and 1 deletions
|
@ -1060,7 +1060,14 @@ ChatPage::trySync()
|
||||||
}
|
}
|
||||||
|
|
||||||
http::client()->sync(
|
http::client()->sync(
|
||||||
opts, [this](const mtx::responses::Sync &res, mtx::http::RequestErr err) {
|
opts,
|
||||||
|
[this, since = cache::nextBatchToken()](const mtx::responses::Sync &res,
|
||||||
|
mtx::http::RequestErr err) {
|
||||||
|
if (since != cache::nextBatchToken()) {
|
||||||
|
nhlog::net()->warn("Duplicate sync, dropping");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
const auto error = QString::fromStdString(err->matrix_error.error);
|
const auto error = QString::fromStdString(err->matrix_error.error);
|
||||||
const auto msg = tr("Please try to login again: %1").arg(error);
|
const auto msg = tr("Please try to login again: %1").arg(error);
|
||||||
|
|
Loading…
Reference in a new issue