commit 926c6875570592f6962812cbd83abec07ff040aa
parent a6742512f6c0e20de02e7c19f94f7dde56b38d58
Author: Joel-Haeberli <haebu@rubigen.ch>
Date: Wed, 22 May 2024 00:12:31 +0200
fix: last retry will be set infinitely often
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/c2ec/proc-retrier.go b/c2ec/proc-retrier.go
@@ -52,14 +52,20 @@ func retryCallback(n *Notification, errs chan error) {
return
}
- withdrawal, err := DB.GetWithdrawalById(withdrawalId)
+ w, err := DB.GetWithdrawalById(withdrawalId)
if err != nil {
LogError("proc-retrier", err)
errs <- err
return
}
- attest(withdrawal, errs)
+ var lastRetryTs int64 = 0
+ if w.LastRetryTs != nil {
+ lastRetryTs = *w.LastRetryTs
+ }
+ if ShouldStartRetry(time.Unix(lastRetryTs, 0), int(w.RetryCounter), CONFIG.Server.RetryDelayMs) {
+ attest(w, errs)
+ }
}
func attest(withdrawal *Withdrawal, errs chan error) {