Open ejball opened 2 years ago
Retrying deadlocks can be done with the same IDbConnection
, but retrying other transient errors necessitates a new IDbConnection
, which is not something safely done automatically for anything but the first command, since there may be session state that needs to be retained.
Reducing the scope of this issue to retrying deadlocks. RetryDeadlockDbConnector
(or RetryTransactionDbConnector
?) might be a better name. Throwing on BeginTransaction
would create a pit of success. Needs #46.
A
RetryDbConnector
could retry operations on transient and/or deadlock exceptions.This would work well with
ExecuteTransaction
(#46) but not withBeginTransaction
etc. ShouldRetryDbConnector.BeginTransaction
throw?The settings should integrate well with
Polly
, ideally without taking a dependency on it.Expose a
Retry(Async)
method that allows the caller to create their own retry units?We would probably need protected overrides on
DbConnector
to which command operations would delegate so that we can retry queries.