Skip to main content

retry_on_concurrent_modification

Attribute Macro retry_on_concurrent_modification 

Source
#[retry_on_concurrent_modification]
Expand description

Retries the annotated async function when it fails with a concurrent modification error (or with any error when any_error = true).

Attempts are spaced with exponential backoff (25ms, 50ms, 100ms, … capped at 1s) so a contended entity is not hammered in a hot loop while the conflicting writer finishes its transaction.

§Arguments

  • max_retries = N — maximum attempts (default: 3)
  • any_error = true|false — retry on any error, not just concurrent modifications (default: false). Only enable this when the annotated function is fully idempotent.