Unverified Commit 1094935b authored by hc-github-team-nomad-core's avatar hc-github-team-nomad-core Committed by GitHub
Browse files

Merge pull request #12658 from hashicorp/backport/csi_hook_timer/positively-kind-possum

This pull request was automerged via backport-assistant
No related merge requests found
Showing with 5 additions and 4 deletions
+5 -4
......@@ -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"
)
......@@ -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)
......@@ -306,7 +307,7 @@ func (c *csiHook) unmountWithRetry(pair *volumeAndRequest) error {
backoff = c.maxBackoffInterval
}
}
ticker.Reset(backoff)
t.Reset(backoff)
}
return nil
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment