Class OptimisticConcurrencyRetryPolicy
- Namespace
- MailFathom.Application.Persistence
- Assembly
- MailFathom.Application.dll
Retries a safe local write after optimistic concurrency conflicts.
public sealed class OptimisticConcurrencyRetryPolicy
- Inheritance
-
OptimisticConcurrencyRetryPolicy
- Inherited Members
Remarks
This policy is the only place where a conflict is an expected control-flow branch rather than a failure. Callers opt in by supplying a write that is idempotent and safe to repeat from a fresh read; once the configured attempts are exhausted the conflict leaves the policy as PersistenceConcurrencyConflictException so no intermediate use-case code has to restate it.
Constructors
- OptimisticConcurrencyRetryPolicy(IPersistenceSessionFactory, PersistenceConcurrencyOptions, TimeProvider)
Initializes a retry policy from the deployment-wide concurrency bound.
Methods
- CommitAsync(Func<IPersistenceSession, CancellationToken, Task>, CancellationToken)
Stages and commits a complete local write in a fresh session for every attempt.