summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-07-27 16:37:29 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-07-27 16:37:29 +0200
commit12090c0a06403d7c21e6dc2df03d9c526c0b3768 (patch)
tree84a69cd9a431d1250c1494ef256bb2f260d1f50b /src
parentFix migration (hopefully) (diff)
downloadnheko-12090c0a06403d7c21e6dc2df03d9c526c0b3768.tar.xz
Add workaround for duplicate syncs
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp

index 012f1e69..518be31c 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp
@@ -1060,7 +1060,14 @@ ChatPage::trySync() } 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) { const auto error = QString::fromStdString(err->matrix_error.error); const auto msg = tr("Please try to login again: %1").arg(error);