perf: Always fetch at least N events per GME

This commit is contained in:
timedout
2026-06-27 20:21:18 +01:00
committed by Jade Ellis
parent 0e0c7826ab
commit ae378bbdb7
@@ -497,7 +497,13 @@ pub async fn get_missing_events(
let limit = iteration
.expected_add(1)
.saturating_mul(10)
.min(GET_MISSING_EVENTS_MAX_BATCH_SIZE);
.min(GET_MISSING_EVENTS_MAX_BATCH_SIZE)
.max(
// This max call ensures we fetch *at least* all the prev events the
// head has.
u16::try_from(head.prev_events.len())
.expect("cannot have more than 20 prev events, which fits in u16"),
);
debug_info!(elapsed=?start.elapsed(),
%limit,
%via,