Skip to content

refactor(webhook): use gateway request context for transformer adapter timeout#6788

Open
akshit-git24 wants to merge 3 commits intorudderlabs:masterfrom
akshit-git24:refactor/webhook-context-timeout
Open

refactor(webhook): use gateway request context for transformer adapter timeout#6788
akshit-git24 wants to merge 3 commits intorudderlabs:masterfrom
akshit-git24:refactor/webhook-context-timeout

Conversation

@akshit-git24
Copy link
Copy Markdown
Contributor

@akshit-git24 akshit-git24 commented Mar 22, 2026

Hi @atzoum @mihir20

Description

This PR refactors the existing context in the batchTransformLoop in the webhook.go . Currently there is a TODO : Remove timeout from here after timeout handler is added in gateway. The worker was creating an isolated, hardcoded 10-second timer instead of properly inheriting the master HTTP timeout rules from the original incoming webhook request. . After the changes made in #6751, we can now safely use the original incoming webhook request as same as of gateway.

changes

  • Removed context.WithTimeout and the associated cancel() function calls in batchTransformLoop.
  • Replaced the manual context with req.request.Context().
  • Deleted the resolved TODO comment.

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

Comment thread gateway/webhook/webhook.go Outdated
Comment on lines +324 to +326
if len(breq.batchRequest) == 0 { //ensures that we don't process empty batch requests
continue
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is never empty

Suggested change
if len(breq.batchRequest) == 0 { //ensures that we don't process empty batch requests
continue
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @atzoum ,
Thanks for the clarity about the batch requests that it would never be empty. Let me remove these line of code and push the changes.

Let me know is there any more advancements needed.

Thank You

@akshit-git24 akshit-git24 requested a review from atzoum April 2, 2026 14:36
@akshit-git24
Copy link
Copy Markdown
Contributor Author

Hi @atzoum , I've removed the redundant check in my latest commit.

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