Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/instancegroups - fix static check #8186

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion hack/.staticcheck_failures
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dnsprovider/pkg/dnsprovider/providers/google/clouddns/internal
dnsprovider/pkg/dnsprovider/providers/google/clouddns/internal/stubs
node-authorizer/pkg/authorizers/aws
node-authorizer/pkg/server
pkg/instancegroups
pkg/resources/ali
pkg/resources/aws
pkg/resources/digitalocean
Expand Down
5 changes: 3 additions & 2 deletions pkg/instancegroups/instancegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,15 @@ func (r *RollingUpdateInstanceGroup) validateClusterWithDuration(rollingUpdateDa
}

timeout := time.After(duration)
tick := time.Tick(rollingUpdateData.ValidateTickDuration)
ticker := time.NewTicker(rollingUpdateData.ValidateTickDuration)
defer ticker.Stop()
// Keep trying until we're timed out or got a result or got an error
for {
select {
case <-timeout:
// Got a timeout fail with a timeout error
return fmt.Errorf("cluster did not validate within a duration of %q", duration)
case <-tick:
case <-ticker.C:
// Got a tick, validate cluster
if r.tryValidateCluster(rollingUpdateData, duration, rollingUpdateData.ValidateTickDuration) {
return nil
Expand Down