mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
Remove timeout logic from ReadRaw functions and add ReadRawWithContext (#18708)
Removing the timeout logic from raw-response functions and adding documentation comments. The following functions are affected: - `ReadRaw` - `ReadRawWithContext` (newly added) - `ReadRawWithData` - `ReadRawWithDataWithContext` The previous logic of using `ctx, _ = c.c.withConfiguredTimeout(ctx)` could cause a potential [context leak](https://pkg.go.dev/context): > Failing to call the CancelFunc leaks the child and its children until the parent is canceled or the timer fires. The go vet tool checks that CancelFuncs are used on all control-flow paths. Cancelling the context would have caused more issues since the context would be cancelled before the request body is closed. Resolves: #18658
This commit is contained in:
committed by
GitHub
parent
d205193daf
commit
ef3e3eace2
@@ -114,7 +114,11 @@ type Config struct {
|
||||
// of three tries).
|
||||
MaxRetries int
|
||||
|
||||
// Timeout is for setting custom timeout parameter in the HttpClient
|
||||
// Timeout, given a non-negative value, will apply the request timeout
|
||||
// to each request function unless an earlier deadline is passed to the
|
||||
// request function through context.Context. Note that this timeout is
|
||||
// not applicable to Logical().ReadRaw* (raw response) functions.
|
||||
// Defaults to 60 seconds.
|
||||
Timeout time.Duration
|
||||
|
||||
// If there is an error when creating the configuration, this will be the
|
||||
|
||||
Reference in New Issue
Block a user