Skip to content
Leader docs0.4

Failure and cancellation

Latest stable Based on Leader release 0.4.0

Separate ordinary contention, action failure, backend failure, cancellation, and ownership loss.

Contention returns skipped. Action exceptions propagate from nullable APIs or appear as ActionFailed in result APIs. Backend acquire failures are infrastructure errors and are not disguised as contention. Cancellation propagates. Lease extension can additionally report NotHeld, WrongThread, or BackendError.

Count skipped separately from failed. Retry a backend error only after classifying it and checking whether the action may already have started. Never retry an action failure blindly. On NotHeld, stop or fence remaining external writes because another contender may acquire ownership.

Stop scheduling new attempts, cancel scoped coroutine jobs, wait for bounded in-flight work, then close the elector’s backend client according to its ownership contract. Framework integrations help bind this sequence to application lifecycle, but the application still owns the action’s cancellation safety.