Skip to content

Commit 2e590e2

Browse files
committed
refactor(event cache): only mark that we've waited for an initial previous-batch token after a sync
It doesn't make sense to do it after a back-pagination, since a back-pagination does require a previous-batch token in the first place, meaning that if we did paginate, then we did wait for a previous-batch token beforehand.
1 parent 224e437 commit 2e590e2

File tree

1 file changed

+6
-8
lines changed
  • crates/matrix-sdk/src/event_cache/room

1 file changed

+6
-8
lines changed

crates/matrix-sdk/src/event_cache/room/mod.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,14 +1098,6 @@ mod private {
10981098
}
10991099
}
11001100

1101-
// If we've never waited for an initial previous-batch token, and we now have at
1102-
// least one gap in the chunk, no need to wait for a previous-batch token later.
1103-
if !self.waited_for_initial_prev_token
1104-
&& self.events.chunks().any(|chunk| chunk.is_gap())
1105-
{
1106-
self.waited_for_initial_prev_token = true;
1107-
}
1108-
11091101
Ok(())
11101102
}
11111103

@@ -1383,6 +1375,12 @@ mod private {
13831375
})
13841376
.await?;
13851377

1378+
// If we've never waited for an initial previous-batch token, and we've now
1379+
// inserted a gap, no need to wait for a previous-batch token later.
1380+
if !self.waited_for_initial_prev_token && prev_batch.is_some() {
1381+
self.waited_for_initial_prev_token = true;
1382+
}
1383+
13861384
if timeline.limited && prev_batch.is_some() {
13871385
// If there was a previous batch token for a limited timeline, unload the chunks
13881386
// so it only contains the last one; otherwise, there might be a

0 commit comments

Comments
 (0)