http4s / http4s-servlet

http4s-servlet support
Apache License 2.0
6 stars 5 forks source link

Render async timeouts in the listener, as Jetty 9 requires #221

Closed rossabaker closed 1 year ago

rossabaker commented 1 year ago

Should fix the issue in http4s/http4s-jetty#118.

The problem here is that we need to call complete() on the same thread that receives the onTimeout() (see eclipse/jetty.project#6227). Instead of racing a timeout response against the service response and rendering the winner, we race a unit callback against the service response, and render the timeout response using the Servlet API. We only call context.complete() wherever we actually render the response.

rossabaker commented 1 year ago

Reviews welcome, but I'm going to do a release candidate so we can test this on the open Jetty PR.