-
Notifications
You must be signed in to change notification settings - Fork 24
Add upload timeout #743
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
Add upload timeout #743
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,11 +331,14 @@ func gatherAndOutputData(ctx context.Context, eventf Eventf, config CombinedConf | |
|
|
||
| notificationFunc := backoff.Notify(func(err error, t time.Duration) { | ||
| eventf("Warning", "PushingErr", "retrying in %v after error: %s", t, err) | ||
| log.Info("Warning: PushingErr: retrying", "in", t, "reason", err) | ||
| log.Error(err, "Warning: PushingErr: will retry", "retry_after", t) | ||
| }) | ||
|
|
||
| post := func() (any, error) { | ||
| return struct{}{}, postData(klog.NewContext(ctx, log), config, preflightClient, readings) | ||
| postCtx, cancel := context.WithTimeout(ctx, config.BackoffMaxTime) | ||
| defer cancel() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Good idea, using the existing BackoffMaxTime as the operation timeout, to ensure that no single upload attempt can hang for ever and block the retry. It seems to me that the backoff module should do this, but it doesn't seem to.
...and the author seems to be adamant that the supplied function should do it's own context cancellation: |
||
|
|
||
| return struct{}{}, postData(klog.NewContext(postCtx, log), config, preflightClient, readings) | ||
| } | ||
|
|
||
| group.Go(func() error { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will make the temporary problem more prominent (Error instead of Info) in the logs of the affected user.
There's a risk that other users might find it annoying to suddenly get new errors logged in normal operation.
This backoff feature is intended to smooth over temporary network errors or API errors, so that the user doesn't have to worry about them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Richard. I believe a warning level is more appropriate.