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

Make timeout per-request #1181

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Make timeout per-request #1181

merged 1 commit into from
Mar 28, 2023

Conversation

Kern--
Copy link
Contributor

@Kern-- Kern-- commented Mar 27, 2023

Part of #1180

When setting up an rhttp client, the structure looks like this:

http.Client {
    Transport: rhttp.Transport {
        Client: rhttp.Client {
            HTTPClient: http.Client{}
        }
    }
}

Before this change, the timeout was set on the outer client. When the timeout was reached, the request context was cancelled and no more retries would be attempted by the retryable client. Effectively the timeout was being set for the entire retryable request.

This change moves the timeout to the inner client, making the timeout per-request and the timeout of the entire retryable request is governed by the retry policy.

@ktock
Copy link
Member

ktock commented Mar 28, 2023

@Kern-- Thank you for the patch, looks good to me. Could you rebase thie patch on the latest main branch for fixing the CI failure?

When setting up an rhttp client, the structure looks like this:
```
http.Client {
    Transport: rhttp.Transport {
        Client: rhttp.Client {
            HTTPClient: http.Client{}
        }
    }
}
```

Before this change, the timeout was set on the outer client. When the
timeout was reached, the request context was cancelled and no more
retries would be attempted by the retryable client. Effectively the
timeout was being set for the entire retryable request.

This change moves the timeout to the inner client, making the timeout
per-request and the timeout of the entire retryable request is governed
by the retry policy.

Signed-off-by: Kern Walster <walster@amazon.com>
@ktock
Copy link
Member

ktock commented Mar 28, 2023

Thanks!

@ktock ktock merged commit d3db79c into containerd:main Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants