summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-08-07 13:12:45 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-08-07 13:12:45 +0200
commitb972d827cb1d3c35e8c561d1245204bd6f4b21f9 (patch)
tree1ca0ec6c6dda784b152bb8bfe134fa283b4b00b9
parentAlso request keys from own devices (diff)
downloadnheko-b972d827cb1d3c35e8c561d1245204bd6f4b21f9.tar.xz
Try to fix issue of pagination interfering with limited: true
-rw-r--r--src/timeline/EventStore.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index 0e4c8b05..a983fe01 100644
--- a/src/timeline/EventStore.cpp
+++ b/src/timeline/EventStore.cpp
@@ -529,6 +529,12 @@ EventStore::fetchMore()
 
         http::client()->messages(
           opts, [this, opts](const mtx::responses::Messages &res, mtx::http::RequestErr err) {
+                  if (cache::client()->previousBatchToken(room_id_) != opts.from) {
+                          nhlog::net()->warn("Cache cleared while fetching more messages, dropping "
+                                             "/messages response");
+                          emit fetchedMore();
+                          return;
+                  }
                   if (err) {
                           nhlog::net()->error("failed to call /messages ({}): {} - {} - {}",
                                               opts.room_id,