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

add SendEventWithContext method #824

Merged
merged 5 commits into from May 6, 2024

Conversation

viglia
Copy link
Contributor

@viglia viglia commented May 3, 2024

This will let us pass a context.Context when creating a new request with getRequestFromEvent.

This will let us have a more granular control over how/when we cancel a request instead of relying only on the client timeout.

For example, if such API is invoked while serving another HTTP request, we might want to take advantage of such request context to bail out earlier than the client timeout if necessary.

As per documentation:

For outgoing client requests, the context controls cancellation.

For incoming server requests, the context is canceled when the client's connection closes, the request is canceled (with HTTP/2), or when the ServeHTTP method returns.

this will let us pass a context.Context when creating a new request with
getRequestFromEvent.
@viglia viglia self-assigned this May 3, 2024
Copy link

codecov bot commented May 3, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 81.73%. Comparing base (9a9f285) to head (29b6dad).

Files Patch % Lines
transport.go 81.81% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #824      +/-   ##
==========================================
- Coverage   81.74%   81.73%   -0.02%     
==========================================
  Files          50       50              
  Lines        4427     4434       +7     
==========================================
+ Hits         3619     3624       +5     
- Misses        659      660       +1     
- Partials      149      150       +1     

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

@viglia viglia requested review from phacops and cleptric May 3, 2024 15:18
transport.go Outdated Show resolved Hide resolved
@viglia viglia requested a review from phacops May 3, 2024 15:36
transport.go Outdated Show resolved Hide resolved
Copy link
Member

@cleptric cleptric left a comment

Choose a reason for hiding this comment

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

Could you add a bit more about the why?

transport.go Outdated Show resolved Hide resolved
@viglia viglia requested a review from cleptric May 3, 2024 17:39
@viglia viglia merged commit 3192e9f into master May 6, 2024
20 checks passed
@viglia viglia deleted the viglia/feat/create-request-with-context branch May 6, 2024 17:05
@cleptric cleptric mentioned this pull request May 6, 2024
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.

None yet

3 participants