Skip to content

Enhance HTTP resilience by ignoring timeouts for Server-Sent Events#12

Open
Hanskrogh wants to merge 1 commit intoChilliCream:mainfrom
Hanskrogh:fix/http-resilience-ignore-sse-timeouts
Open

Enhance HTTP resilience by ignoring timeouts for Server-Sent Events#12
Hanskrogh wants to merge 1 commit intoChilliCream:mainfrom
Hanskrogh:fix/http-resilience-ignore-sse-timeouts

Conversation

@Hanskrogh
Copy link

This pull request enhances the resilience and reliability of HTTP client requests in the AddServiceDefaults extension, especially for Server-Sent Events (SSE). It introduces custom timeout and retry logic for SSE requests, ensuring they are not interrupted by standard timeout or retry policies. Additionally, it includes some minor code cleanups and formatting improvements.

Resilience improvements for HTTP clients:

  • Customizes the AddStandardResilienceHandler to detect Server-Sent Event (SSE) requests and disables both attempt and total request timeouts for them, preventing SSE connections from being prematurely closed.
  • Prevents retries for SSE requests by customizing the retry policy, ensuring that SSE streams are not retried if they fail.
  • Adds a private IsServerSentEventRequest helper method to identify SSE requests by checking for the text/event-stream media type in the Accept header.

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.

1 participant