-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client-go: reset request body after response is read and closed
This commit refactors the retry logic to include resetting the request body. The reset logic will be called iff it is not the first attempt. This refactor is nescessary mainly because now as per the retry logic, we always ensure that the request body is reset *after* the response body is *fully* read and closed in order to reuse the same TCP connection. Previously, the reset of the request body and the call to read and close the response body were not in the right order, which leads to race conditions. This commit also adds a test that verifies the order in which the function calls are made to ensure that we seek only after the response body is closed. Co-authored-by: Madhav Jivrajani <[email protected]> Kubernetes-commit: 68c8c458ee8f6629eef806c48c1a776dedad3ec4
- Loading branch information
1 parent
8a672f0
commit 01ab7fb
Showing
3 changed files
with
150 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters