Revert "Tiny: use `Load` instead of `CompareAndSwap` for detecting recoveries (#69)"

This reverts commit a0df11f512.
This commit is contained in:
Josh van Leeuwen 2023-10-30 16:19:36 +00:00 committed by GitHub
parent a0df11f512
commit 8b5f336115
1 changed files with 2 additions and 2 deletions

View File

@ -159,7 +159,7 @@ func NotifyRecover(operation backoff.Operation, b backoff.BackOff, notify backof
return backoff.RetryNotify(func() error {
err := operation()
if err == nil && notified.Load() {
if err == nil && notified.CompareAndSwap(true, false) {
recovered()
}
@ -178,7 +178,7 @@ func NotifyRecoverWithData[T any](operation backoff.OperationWithData[T], b back
return backoff.RetryNotifyWithData(func() (T, error) {
res, err := operation()
if err == nil && notified.Load() {
if err == nil && notified.CompareAndSwap(true, false) {
recovered()
}