fix(webhook): propagate request context in batchTransformLoop - #6988
Closed
reki7o7 wants to merge 1 commit into
Closed
fix(webhook): propagate request context in batchTransformLoop#6988reki7o7 wants to merge 1 commit into
reki7o7 wants to merge 1 commit into
Conversation
|
Thank you @reki7o7 for contributing this PR. |
atzoum
reviewed
May 27, 2026
| // If unable to fetch features from transformer, send GatewayTimeout to all requests | ||
| // TODO: Remove timeout from here after timeout handler is added in gateway | ||
| ctx, cancel := context.WithTimeout(context.Background(), config.GetDurationVar(10, time.Second, "WriteTimeout", "WriteTimeOutInSec")) | ||
| ctx := breq.batchRequest[0].request.Context() |
Contributor
There was a problem hiding this comment.
This doesn’t really improve things. In fact, it introduces a new bug by tying the webhook context to the first request’s context. Since a batch can contain multiple requests, if the client from the first request disconnects, all other clients in the batch will receive an error response.
Maybe we should just remove the TODO to avoid confusing people and agents.
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.
This PR resolves #6787.
The previous implementation used a hardcoded timeout context when calling the source transformer adapter, which detached execution from the original request lifecycle and ignored gateway-level timeout/cancellation handling.
This change replaces that with the HTTP request context from the batch request so transformer calls respect the existing gateway timeout behavior.
Note: I was unable to fully run the package tests locally because the repository currently has Windows-specific build incompatibilities (
syscall.Stat_tinutils/misc), but the change is minimal and scoped to the requested fix.This is a clean resubmission of the previously stale PR #6788 with the requested minimal change.