Function tikv::coprocessor::interceptors::concurrency_limiter::limit_concurrency[][src]

pub fn limit_concurrency<'a, F: Future + 'a>(
    fut: F,
    semaphore: &'a Semaphore,
    time_limit_without_permit: Duration
) -> impl Future<Output = F::Output> + 'a

Limits the concurrency of heavy tasks by limiting the time spent on executing fut before forcing to acquire a semaphore permit.

The future fut can always run for at least time_limit_without_permit, but it needs to acquire a permit from the semaphore before it can continue.