Use use max_items as bound in tower-batch (#1691)

This commit is contained in:
Alfredo Garcia 2021-02-04 23:42:38 -03:00 committed by GitHub
parent e455c3fa8a
commit bfb3de7a8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -57,8 +57,12 @@ where
T::Error: Send + Sync, T::Error: Send + Sync,
Request: Send + 'static, Request: Send + 'static,
{ {
// XXX(hdevalence): is this bound good // The semaphore bound limits the maximum number of concurrent requests
let bound = 1; // (specifically, requests which got a `Ready` from `poll_ready`, but haven't
// used their semaphore reservation in a `call` yet).
// We choose a bound that allows callers to check readiness for every item in
// a batch, then actually submit those items.
let bound = max_items;
let (tx, rx) = mpsc::unbounded_channel(); let (tx, rx) = mpsc::unbounded_channel();
let (handle, worker) = Worker::new(service, rx, max_items, max_latency); let (handle, worker) = Worker::new(service, rx, max_items, max_latency);
tokio::spawn(worker.run()); tokio::spawn(worker.run());