(start-pool!)(start-pool! {:keys [num-workers queue-size]
:or {num-workers
(max 1 (dec (.availableProcessors (Runtime/getRuntime))))
queue-size 10}})Starts a new worker pool for processing compute-bound requests. Opts:
Returns a pool object (a map) which can be passed to wrap-compute-bound
or stop-pool!.
Starts a new worker pool for processing compute-bound requests. Opts: - :num-workers (default: cores - 1, or 1) - :queue-size (default: 10) Returns a pool object (a map) which can be passed to `wrap-compute-bound` or `stop-pool!`.
(wrap-compute-bound handler pool)(wrap-compute-bound handler
pool
{:keys [timeout-ms on-reject on-timeout]
:or {timeout-ms 30000
on-reject default-reject-handler
on-timeout default-timeout-handler}})Ring middleware that limits concurrent compute-intensive requests by queueing them to a worker pool.
Accepts a pool created by start-pool! and opts:
Ring middleware that limits concurrent compute-intensive requests by queueing them to a worker pool. Accepts a `pool` created by `start-pool!` and `opts`: - :timeout-ms (default: 30000) - :on-reject (fn [request] -> response, called when queue is full) - :on-timeout (fn [request] -> response, called when queue timeout happens)
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 |