Skip to main content

run_in_isolated_tx_with_retries

Function run_in_isolated_tx_with_retries 

Source
pub async fn run_in_isolated_tx_with_retries<F, Fut, T>(
    pool: &PgPool,
    isolation: TransactionIsolation,
    max_retries: u32,
    body: F,
) -> Result<T, CoolError>
where F: FnMut(Transaction<'static, Postgres>) -> Fut, Fut: Future<Output = Result<(T, Transaction<'static, Postgres>), CoolError>>,
Expand description

Same as run_in_isolated_tx but with a caller-chosen retry budget. Banks running long-tail contended writes sometimes want a higher cap (5–10); single-row CAS workflows can drop to 1 to fail fast.