Skip to content

Commit

Permalink
fix: replace time.Sleep with timer.Wait for cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Jan 11, 2025
1 parent 94e7725 commit fa79338
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/controller/vacuum/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/aquaproj/aqua/v2/pkg/config"
"github.com/aquaproj/aqua/v2/pkg/timer"
"github.com/sirupsen/logrus"
"github.com/spf13/afero"
"github.com/suzuki-shunsuke/logrus-error/logerr"
Expand Down Expand Up @@ -89,7 +90,7 @@ func (vc *Controller) withDBRetry(ctx context.Context, logE *logrus.Entry, fn fu

logerr.WithError(logE, err).WithField("attempt", i+1).Warn("retrying database operation")

time.Sleep(backoff)
timer.Wait(ctx, backoff)

Check failure on line 93 in pkg/controller/vacuum/controller.go

View workflow job for this annotation

GitHub Actions / test / test

Error return value of `timer.Wait` is not checked (errcheck)
backoff *= exponentialBackoff
}

Expand Down

0 comments on commit fa79338

Please sign in to comment.