Skip to content

Class: NodeRunnerDriver ​

Defined in: node/src/executors/node-runner-driver.ts:12

Runtime concurrency limiter implementing RunnerDriver for NodeRunnerNode (local.runner).

Maintains independent PQueue concurrency pools for one-shot subprocess slots (withSlot, bounded by slots) and long-lived background daemon sessions (withDaemonSlot, bounded by maxDaemons) so active daemons never starve one-shot build or test commands.

Implements ​

Constructors ​

Constructor ​

ts
new NodeRunnerDriver(node): NodeRunnerDriver;

Defined in: node/src/executors/node-runner-driver.ts:33

Initializes a NodeRunnerDriver from a compiled NodeRunnerNode.

Sets the pool identifier and initializes independent PQueue instances for slots and maxDaemons.

Parameters ​

ParameterTypeDescription
nodeNodeRunnerNodePassive runner pool AST node.

Returns ​

NodeRunnerDriver

Methods ​

withDaemonSlot() ​

ts
withDaemonSlot<T>(fn, signal?): Promise<T>;

Defined in: node/src/executors/node-runner-driver.ts:82

Acquires a long-lived background daemon slot until releaseDaemonSlot() is invoked.

Holds a concurrency slot in this.daemonQueue across the lifetime of the ServiceSession and automatically releases the slot if the startup callback fn throws before returning.

Type Parameters ​

Type ParameterDescription
TReturn value type of fn.

Parameters ​

ParameterTypeDescription
fn(releaseDaemonSlot) => Promise<T>Daemon startup callback receiving the release handle.
signal?AbortSignalOptional abort signal cancelling daemon slot acquisition.

Returns ​

Promise<T>

Result produced by fn().

Throws ​

If signal aborts while queued or fn() rejects.

Implementation of ​

RunnerDriver.withDaemonSlot


withSlot() ​

ts
withSlot<T>(fn, signal?): Promise<T>;

Defined in: node/src/executors/node-runner-driver.ts:57

Acquires a one-shot command execution slot for the duration of fn().

Queues the caller in this.slotQueue when all slots are occupied, cancels queued waits immediately if signal aborts, detaches the wait-abort listener once dequeued so in-flight cleanup holds the slot until fn() settles, and releases the slot in finally.

Type Parameters ​

Type ParameterDescription
TReturn value type of fn.

Parameters ​

ParameterTypeDescription
fn() => Promise<T>Asynchronous callback executed while holding the slot.
signal?AbortSignalOptional abort signal cancelling slot acquisition or execution.

Returns ​

Promise<T>

Result produced by fn().

Throws ​

If signal aborts while queued or fn() rejects.

Implementation of ​

RunnerDriver.withSlot

Properties ​

id ​

ts
readonly id: string;

Defined in: node/src/executors/node-runner-driver.ts:14

Logical identifier of the runner pool.

Implementation of ​

RunnerDriver.id


maxDaemons ​

ts
readonly maxDaemons: number;

Defined in: node/src/executors/node-runner-driver.ts:18

Maximum concurrent background daemon sessions.


slots ​

ts
readonly slots: number;

Defined in: node/src/executors/node-runner-driver.ts:16

Maximum concurrent one-shot command executions.

Released under the MIT License.