tower-http
tower-http copied to clipboard
Timeout on body
Motivation
Explained in #295. This PR closes #295.
Solution
Wrap the body in a TimeoutBody
. TimeoutBody
will poll a sleep future to check whether the body is inactive and register itself to be awoken. The sleep future is polled and checked right after creation to avoid a potential delay in execution making the executor to never poll the sleep future again. That is, if between creation and poll
on sleep the time runs out and the sleep is done, a timeout error is immediately returned
cc @LucioFranco @seanmonstar @hlbarber