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

Allow HTTP clients to be cancelled by passing along context #565

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

lfittl
Copy link
Member

@lfittl lfittl commented Jul 11, 2024

This replaces all calls of "http.NewRequest" with
"http.NewRequestWithContext", to ensure that the HTTP client stops what its doing immediately when the context gets canceled.

The main motivation here is to better handle network connectivity problems to the pganalyze snapshot API, which otherwise make it seem like the collector hangs when trying to cancel a test run with CTRL+C (SIGINT).

This replaces all calls of "http.NewRequest" with
"http.NewRequestWithContext", to ensure that the HTTP client stops what
its doing immediately when the context gets canceled.

The main motivation here is to better handle network connectivity problems
to the pganalyze snapshot API, which otherwise make it seem like the
collector hangs when trying to cancel a test run with CTRL+C (SIGINT).
@lfittl lfittl requested a review from a team July 11, 2024 00:43
@lfittl lfittl merged commit 44bb410 into main Jul 12, 2024
9 checks passed
@lfittl lfittl deleted the use-http-client-with-context branch July 12, 2024 16:02
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