Skip to content

Commit

Permalink
Merge pull request #12658 from hashicorp/backport/csi_hook_timer/posi…
Browse files Browse the repository at this point in the history
…tively-kind-possum

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core authored Apr 19, 2022
2 parents 0dd8a40 + 199da0e commit 1094935
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/allocrunner/csi_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
hclog "github.com/hashicorp/go-hclog"
multierror "github.com/hashicorp/go-multierror"
"github.com/hashicorp/nomad/client/pluginmanager/csimanager"
"github.com/hashicorp/nomad/helper"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/plugins/drivers"
)
Expand Down Expand Up @@ -286,13 +287,13 @@ func (c *csiHook) unmountWithRetry(pair *volumeAndRequest) error {
defer cancel()
var err error
backoff := time.Second
ticker := time.NewTicker(backoff)
defer ticker.Stop()
t, stop := helper.NewSafeTimer(0)
defer stop()
for {
select {
case <-ctx.Done():
return err
case <-ticker.C:
case <-t.C:
}

err = c.unmountImpl(pair)
Expand All @@ -306,7 +307,7 @@ func (c *csiHook) unmountWithRetry(pair *volumeAndRequest) error {
backoff = c.maxBackoffInterval
}
}
ticker.Reset(backoff)
t.Reset(backoff)
}
return nil
}
Expand Down

0 comments on commit 1094935

Please sign in to comment.