PoolControl
What the primary of a worker pool can do, on ServerHandle.pool.
What the primary of a worker pool can do, on ServerHandle.pool.
Import#
ts
import type { PoolControl } from "@shadow-js/dusk/node";
Signature#
ts
interface PoolControl {
/** How many workers the pool keeps. */
readonly workers: number;
/** The process ids of the workers that are listening now. */
pids(): readonly number[];
/**
* Replaces the workers one by one: a new worker starts and must be listening before the old one drains, so the
* pool never has fewer than `workers` serving. Stops (and leaves the old workers serving) if a new worker fails to start.
* What `SIGUSR2` does. A call while one is running returns the running one.
* @throws Error when the pool is stopping, or a new worker fails to start.
*/
restart(): Promise<void>;
/** Resolves with the reason when the crash-loop breaker stops the pool. Never resolves otherwise, and never rejects. */
readonly failed: Promise<Error>;
}
Members#
| Name | Type | Description |
|---|---|---|
workers |
readonly workers: number |
How many workers the pool keeps. |
pids |
pids(): readonly number[] |
The process ids of the workers that are listening now. |
restart |
restart(): Promise<void> |
Replaces the workers one by one: a new worker starts and must be listening before the old one drains, so the pool never has fewer than workers serving. Stops (and leaves the old workers serving) if a new worker fails to start. What SIGUSR2 does. A call while one is running returns the running one. |
failed |
readonly failed: Promise<Error> |
Resolves with the reason when the crash-loop breaker stops the pool. Never resolves otherwise, and never rejects. |