A supervised, load-balanced set of workers running the same command
(FR-3). Maintains size base workers plus up to max_overflow
temporary overflow workers, created on demand and retired as soon as
they go idle.
Workers are not checked out exclusively: each worker can serve many
concurrent in-flight calls (bounded by its own SDK-advertised
max_concurrency), so "checkout" here means selecting a worker with
spare capacity via least-in-flight scheduling (round-robin among ties),
not reserving it. When every worker (base and overflow) is already at
capacity and max_overflow is exhausted, new calls block for up to
checkout_timeout before failing with %Portals.Error{kind: :checkout_timeout}. Execution timeout (the :timeout given to
call/5/async/5) only starts once a worker is actually selected and
the call is dispatched to it — it is completely independent of how
long checkout itself took.
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type start_opts() :: [ command: binary(), args: [binary()], size: pos_integer(), max_overflow: non_neg_integer(), checkout_timeout: timeout(), name: GenServer.name() ]
Functions
@spec async(GenServer.server(), binary(), binary(), list(), keyword()) :: {:ok, Portals.Request.t()} | {:error, Portals.Error.t()}
@spec await(Portals.Request.t(), timeout()) :: {:ok, term()} | {:error, Portals.Error.t()}
@spec call(GenServer.server(), binary(), binary(), list(), keyword()) :: {:ok, term()} | {:error, Portals.Error.t()}
@spec cancel(Portals.Request.t()) :: :ok
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec health(GenServer.server()) :: map()
@spec start_link(start_opts()) :: GenServer.on_start()
@spec stop(GenServer.server(), timeout()) :: :ok