Skip to main content

with_busy_retry

Function with_busy_retry 

Source
pub fn with_busy_retry<T, F>(op: F) -> Result<T, AppError>
where F: Fn() -> Result<T, AppError>,
Expand description

Executes op up to the resolved busy-retry budget with exponential backoff whenever the operation fails with SQLITE_BUSY / SQLITE_LOCKED.

Policy (GAP-SG-87): XDG db.busy_retries / db.busy_base_delay_ms via crate::runtime_config, falling back to MAX_SQLITE_BUSY_RETRIES and SQLITE_BUSY_BASE_DELAY_MS. Delay schedule (base = resolved base ms): attempt nbase * 2^n with half-jitter in [base/2, base).

After all retries are exhausted the last SQLITE_BUSY error is converted to AppError::DbBusy so callers can route on exit-code 15.