Skip to main content

set_in_flight_budget

Function set_in_flight_budget 

Source
pub fn set_in_flight_budget(limit: usize)
Expand description

Limit how many prefetched loop items may be in flight at once across the whole process, beyond the first item of each loop.

Each #[psync::graph] loop keeps at most its bound items in flight, and nested loops multiply: two nested loops with the default bound of 16 may hold 256 requests. The budget caps the sum over every loop running in the process. The first item of every loop is always free, so every loop makes progress and nested loops cannot deadlock, even with a budget of 0 (which runs every loop one item at a time). The default is unlimited (usize::MAX).

Call it once at start-up, for example with the number of connections your server or pool accepts.