Add Buffer::new note on how to set bound (#425)

This commit is contained in:
Jon Gjengset 2020-03-04 15:48:33 -05:00 committed by GitHub
parent 52d9e95a38
commit b6f5f586c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,12 @@ where
///
/// The default Tokio executor is used to run the given service, which means that this method
/// must be called while on the Tokio runtime.
///
/// # Note on setting `bound`
/// When `Buffer`'s implementation of `poll_ready` returns `Poll::Ready`, it reserves a
/// slot in the channel for the forthcoming `call()`. However, if this call doesn't arrive,
/// this reserved slot may be held up for a long time. As a result, it's advisable to set
/// `bound` to be at least the maximum number of concurrent requests the `Buffer` will see.
pub fn new(service: T, bound: usize) -> Self
where
T: Send + 'static,