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

resource: Retry helper exits before callback finishes #529

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions helper/resource/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,9 @@ func (conf *StateChangeConf) WaitForStateContext(ctx context.Context) (interface
return nil, ctx.Err()
case <-timeout:
log.Printf("[WARN] WaitForState timeout after %s", conf.Timeout)
log.Printf("[WARN] WaitForState starting %s refresh grace period", refreshGracePeriod)

// cancel the goroutine and start our grace period timer
// cancel the goroutine
close(cancelCh)
timeout := time.After(refreshGracePeriod)

// we need a for loop and a label to break on, because we may have
// an extra response value to read, but still want to wait for the
// channel to close.
Expand All @@ -254,9 +251,6 @@ func (conf *StateChangeConf) WaitForStateContext(ctx context.Context) (interface
case <-ctx.Done():
log.Println("[ERROR] Context cancelation detected, abandoning grace period")
break forSelect
case <-timeout:
log.Println("[ERROR] WaitForState exceeded refresh grace period")
break forSelect
}
}

Expand Down