Repository navigation
Conversation
The deadline was still set when the upstream call ran. For a request without a body, net/http's background read uses it, and when it fires it cancels the request context, so a slow upstream failed. Also correct the read timeout text in README.relay.md and config.go.
…le-read-timeouts # Conflicts: # README.relay.md # agent/config/config.go # agent/server/snykbroker/reflector.go
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two environment variables set the agent's read timeouts:
WEBHOOK_READ_TIMEOUTandCORTEX_API_PROXY_READ_TIMEOUT. Each takes a Go duration and defaults to 30s.Before: fixed at 30s (#176). After: an operator can raise one without a new build. The relay reflector setting is gone, because #212 removed the reflector.
Why
Review feedback on #176: 30s can be short for a slow webhook upload or a large Cortex API request body.
How
Review focus:
config.go.AgentConfigmeans 30s./cortex-api/bound covers only the request body. The proxy clears the deadline after the body is read. This fixes a Let the relay reflector wait 30 seconds for a request #176 bug that canceled slow upstream calls.README.md, next to "Calling the Cortex API". Therelaycommand has no webhook server.Verification
go test ./...inagent/passes, exceptTestLoopbackOnlyRefusesOffHostConnection, which fails the same way onmainlocally.