Skip to content

Conversation

@AnonyScorpio
Copy link
Contributor

Motivation

http template read response.Body after cancel(), sometimes it return a context canceled error

Modifications

Read response.Body after cancel(), sometimes it return a context canceled error
For more detail https://groups.google.com/g/golang-nuts/c/2FKwG6oEvos

Verification

Documentation

@AnonyScorpio AnonyScorpio force-pushed the main branch 2 times, most recently from 088ac1f to 3ff8211 Compare September 30, 2025 15:17
@AnonyScorpio
Copy link
Contributor Author

There is no impact because it will be retried several times.

…turn a context canceled error

Signed-off-by: AnonyScorpio <[email protected]>
@AnonyScorpio
Copy link
Contributor Author

There is no impact because it will be retried several times.

Ok, problems can arise if the HTTP request is non-idempotent or time-consuming.

@Joibel
Copy link
Member

Joibel commented Oct 24, 2025

There is no impact because it will be retried several times.

Ok, problems can arise if the HTTP request is non-idempotent or time-consuming.

Why does this PR cause this risk to change? (the risk of having retries call a non-idempotent URL multiple times)

@AnonyScorpio
Copy link
Contributor Author

There is no impact because it will be retried several times.

Ok, problems can arise if the HTTP request is non-idempotent or time-consuming.

Why does this PR cause this risk to change? (the risk of having retries call a non-idempotent URL multiple times)
Read response.Body before response.Body.Close (defer response.Body.Close()) by handle ctx(tmpl.HTTP.TimeoutSeconds) and defer cancel() out of executeHTTPTemplateRequest

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