spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.7k stars 38.14k forks source link

Add request timeout to ResponseBodyEmitter [SPR-13104] #17695

Closed spring-projects-issues closed 9 years ago

spring-projects-issues commented 9 years ago

Bernhard Frauendienst opened SPR-13104 and commented

As discussed in #16826, request handler methods returning a ResponseBodyEmitter (or a subclass like SseEmitter) have no way of specifying a request-specific timeout to be set on the request's AsyncContext. The only way to specify that timeout is using the global default value.

However, most ResponseBodyEmitter connections are explicitly created to be long-running, especially in the Server-Sent Event case (SseEmitter), where the connection is created as an async back-channel to the client. As such, those request handlers will in most cases want to set a much higher timeout value than the one appropriate for single-result async tasks.

Therefore, the possibility to specify a per-request timeout value should be added to the ResponseBodyEmitter (probably similar to the property in DeferredResult).


Affects: 4.2 RC1

Issue Links:

spring-projects-issues commented 9 years ago

Sergey Parakhin commented

Hi, I have a question - Why did you add constructor with timeout only for ResponseBodyEmitter, but not for SseEmitter?

spring-projects-issues commented 9 years ago

Rossen Stoyanchev commented

Yep, I just noticed that myself. I'll open a separate ticket.

spring-projects-issues commented 9 years ago

Rossen Stoyanchev commented

See #18026, thanks.

spring-projects-issues commented 9 years ago

Sergey Parakhin commented

Thank you!