diff --git a/tower-service/src/lib.rs b/tower-service/src/lib.rs index c2f531e1a..a6ef0ecec 100644 --- a/tower-service/src/lib.rs +++ b/tower-service/src/lib.rs @@ -331,6 +331,12 @@ pub trait Service { /// Once `poll_ready` returns `Poll::Ready(Ok(()))`, a request may be dispatched to the /// service using `call`. Until a request is dispatched, repeated calls to /// `poll_ready` must return either `Poll::Ready(Ok(()))` or `Poll::Ready(Err(_))`. + /// + /// Note that `poll_ready` may reserve shared resources that are consumed in a subsequent + /// invocation of `call`. Thus, it is critical for implementations to not assume that `call` + /// will always be invoked and to ensure that such resources are released if the service is + /// dropped before `call` is invoked or the future returned by `call` is dropped before it + /// is polled. fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll>; /// Process the request and return the response asynchronously.