VAULT-8436 remove <-time.After statements in for loops (#18818)

* replace time.After with ticker in loops

* add semgrep rule

* update to use timers

* remove stop
This commit is contained in:
miagilepner
2023-02-06 17:49:01 +01:00
committed by GitHub
parent 192baa88db
commit 13caa0842e
10 changed files with 63 additions and 16 deletions

View File

@@ -366,10 +366,12 @@ func (r *LifetimeWatcher) doRenewWithOptions(tokenMode bool, nonRenewable bool,
return nil
}
timer := time.NewTimer(sleepDuration)
select {
case <-r.stopCh:
timer.Stop()
return nil
case <-time.After(sleepDuration):
case <-timer.C:
continue
}
}