Fanning out inside a system that is also doing its day job. Tasks in
data structures already run in parallel — (__q/task {:a (f) :b (g)})
grounds both at once — and qfor maps in parallel when its body
spawns tasks. The recipe worth naming is the brake: a gate bounds
how many run at once, because an unbounded fan-out over production
data competes with production.
Fanning out inside a system that is also doing its day job. Tasks in
data structures already run in parallel — `(__q/task {:a (f) :b (g)})`
grounds both at once — and `qfor` maps in parallel when its body
spawns tasks. The recipe worth naming is the brake: a `gate` bounds
how many run at once, because an unbounded fan-out over production
data competes with production.(gated n f coll)Run f (element → task) over coll with at most n in flight:
(gated 8 expensive-check ids) is the polite fan-out. Settles to
the results in collection order. The gate participates in structured
concurrency — cancelling the eval cancels the enqueued work with it,
nothing keeps running behind the brake.
Run `f` (element → task) over `coll` with at most `n` in flight: `(gated 8 expensive-check ids)` is the polite fan-out. Settles to the results in collection order. The gate participates in structured concurrency — cancelling the eval cancels the enqueued work with it, nothing keeps running behind the brake.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |