Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use ctx background when calling webhook async #115

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

bthari
Copy link
Contributor

@bthari bthari commented Aug 14, 2024

Context

When trying to call a webhook within an API call, the context that usually will be passed is request context. Issue is, this context will expire when the client API call is done (either by timeout, cancel, or finished process), therefore when calling the async webhook with NewRequestWithContext it might produce an error because the request will not wait for aync call, as it's called in another go routine.

To mitigate this issue, the async webhook call will use context.Background() instead.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.39%. Comparing base (83f620d) to head (62758aa).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #115   +/-   ##
=======================================
  Coverage   56.39%   56.39%           
=======================================
  Files          48       48           
  Lines        2477     2477           
=======================================
  Hits         1397     1397           
  Misses        884      884           
  Partials      196      196           
Flag Coverage Δ
api-test 56.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@deadlycoconuts deadlycoconuts left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for finding out about this problem!

@bthari bthari merged commit 9b92012 into main Aug 15, 2024
9 of 10 checks passed
@bthari bthari deleted the webhook-async-use-ctx-background branch August 15, 2024 07:10
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