package current

  1. Overview
  2. Docs

Resource pools, to control how many jobs can use a resource at a time. To use a pool within a job, pass the pool to Job.start or call Job.use_pool.

type 'a t
type priority = [
  1. | `High
  2. | `Low
]
val create : label:string -> int -> unit t

create ~label n is a pool with n resources.

  • parameter label

    Used for metric reporting and logging.

val of_fn : label:string -> (priority:priority -> switch:Switch.t -> 'a Lwt.t * (unit -> unit Lwt.t)) -> 'a t

of_fn ~label f is a pool that uses f to get a resource. It should return a promise for the resource and a function that cancels the request (if still queued). Return the resource to the pool when switch is turned off.

OCaml

Innovation. Community. Security.