Skip to main content

next_adaptive_batch_size

Function next_adaptive_batch_size 

Source
pub fn next_adaptive_batch_size(
    current: usize,
    base: usize,
    under_pressure: bool,
) -> usize
Expand description

Decide the next adaptive fetch size from current pressure state.

  • Under pressure: shrink to 75 %, but never below [ADAPTIVE_MIN_BATCH].
  • Otherwise: grow to 125 %, but never above the schema-chosen base ceiling (so we recover toward the initial fetch size without overshooting it).

Pure function — exported so adaptive batch-sizing can be unit-tested without a live database.