backoff
backoff copied to clipboard
Distinguish between permanent and transient errors when giving up on a backoff strategy
It looks like there is no native way to check whether a strategy gave up due to reaching its end with no success (constantly hitting transient errors) and due to a permanent error.
This can be done depending on the returned error, but some variants may be used both as permanent or transient, meaning that the inner error may have to include whether it is transient or permanent. This adds a lot of boilerplate. e.g.
enum RetryError {
// Permanent
Y,
Z,
// Transient
B,
C
// Both (bool indicates whether this is permanent or transient)
N(bool),
M(bool),
}
TL;DR: It'd be great if retry
and retry_notify
could return a flag indicating whether it stopped due to an accumulation of transient errors or due to a permanent one.