commit f1d8cacb91336a023f0068da7823b3e5352ad287
parent 1d4fce3236bedb4fd5082a7997406a993abf8e78
Author: Joel-Haeberli <haebu@rubigen.ch>
Date: Mon, 3 Jun 2024 17:07:56 +0200
fix: enhance logging
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/c2ec/proc-transfer.go b/c2ec/proc-transfer.go
@@ -41,7 +41,7 @@ func RunTransferrer(
LogInfo("proc-transfer", "transferrer executing transfers")
lastlog = time.Now()
}
- executePendingTransfers(errs)
+ executePendingTransfers(errs, lastlog)
}
}()
}
@@ -119,7 +119,7 @@ func transferCallback(notification *Notification, errs chan error) {
}
}
-func executePendingTransfers(errs chan error) {
+func executePendingTransfers(errs chan error, lastlog time.Time) {
transfers, err := DB.GetTransfersByState(TRANSFER_STATUS_RETRY)
if err != nil {
@@ -128,7 +128,9 @@ func executePendingTransfers(errs chan error) {
return
}
- LogInfo("proc-transfer", fmt.Sprintf("found %d pending transfers", len(transfers)))
+ if lastlog.Before(time.Now().Add(time.Second * -30)) {
+ LogInfo("proc-transfer", fmt.Sprintf("found %d pending transfers", len(transfers)))
+ }
for _, t := range transfers {
shouldRetry := ShouldStartRetry(time.Unix(t.TransferTs, 0), int(t.Retries), MAX_TRANSFER_BACKOFF_MS)