Skip to content

Commit

Permalink
service: clarify docs around shared resource consumption in poll_read…
Browse files Browse the repository at this point in the history
…y() (#662)

Signed-off-by: Matt Klein <mklein@lyft.com>
  • Loading branch information
mattklein123 authored and hawkw committed Jun 17, 2022
1 parent c3d1607 commit 0feb182
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tower-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,12 @@ pub trait Service<Request> {
/// 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<Result<(), Self::Error>>;

/// Process the request and return the response asynchronously.
Expand Down

0 comments on commit 0feb182

Please sign in to comment.