pub fn with_busy_retry_policy<T, F>(
max_retries: u32,
base_delay_ms: u64,
op: F,
) -> Result<T, AppError>Expand description
with_busy_retry with the schedule supplied instead of resolved.
The ambient resolution is correct for the binary and wrong for a test. The
schedule is exponential, so its total duration is governed by whatever the
DEVELOPER happens to have in XDG: at the compiled defaults of 5 retries and
300 ms a contention test costs about nine seconds, while a machine carrying
db.busy_retries = 12 and db.busy_base_delay_ms = 600 pays roughly THIRTY
MINUTES for the same test. Measured, not theorised — it is why the suite
appeared to hang for four consecutive sessions on this workstation, and the
two tests involved were reported as “running for over 60 seconds” while they
were in fact working exactly as written.
A test that reads ambient configuration is the same confused-deputy shape GAP-SG-205 describes: behaviour governed by state nobody declared. So the contention tests state their own schedule and the binary keeps resolving its.
§Errors
Returns AppError::DbBusy once max_retries attempts are exhausted, and
propagates any non-busy error unchanged.