Classes

c
WorkerExitError(
taskModule: string,
code: number | null
)

Thrown into a task's promise when its worker's THREAD ENDED while the task was in flight — a clean self-termination (process.exit() inside the worker, or self.close() on runtimes that report it) as much as an abrupt one.

c
WorkerPoolService(
options: WorkerPoolPluginOptions | undefined,
runtime: IRuntimeServices,
collector?: WorkerPoolCollector
)

The worker pool service registered under CAPABILITIES.WORKER_POOL.

c
WorkerPoolUnavailableError(message?: string)

Thrown by run() when the runtime provides no worker support (no IRuntimeServices.workers and no injected host) — e.g. Cloudflare Workers.

c
WorkerQueueFullError(
taskModule: string,
limit: number
)

Thrown by run() when the pool's pending queue is at its bound, shedding the task instead of growing memory without limit.

c
WorkerTaskError(
taskModule: string,
remote: WorkerErrorShape
)

Thrown by run() when the task handler threw on the worker, or when the worker crashed while the task was in flight. Carries the remote error's serialized shape.

c
WorkerTaskTimeoutError(
taskModule: string,
timeoutMs: number
)

Thrown by run() when a task exceeds its timeout. The worker running the task is terminated and replaced — in-flight JavaScript cannot be cancelled.

Functions

Interfaces

I
TaskPoolOptions

Per-task-module pool overrides, keyed by task-module specifier in WorkerPoolPluginOptions.pools.

  • maxQueue: number

    Pending-queue bound for this pool; overrides the plugin maxQueue.

  • size: number

    Workers in this pool; overrides defaultPoolSize.

  • taskTimeoutMs: number

    Task timeout in milliseconds for this pool; overrides the plugin taskTimeoutMs. 0 disables the timeout.

I
WorkerPoolPluginOptions

Options for WorkerPoolPlugin.

Usage

import * as WorkerPoolPlugin___run_CPU_bound_tasks_on_real_worker_threads_behind_the__CAPABILITIES_WORKER_POOL__capability__Task_modules_register_their_handler_with__defineWorkerTask__from___setu_ts_runtime_worker__and_are_addressed_by_module_specifier___Every_export_is_documented_in_PUBLIC_API_md_ from "worker-pool-plugin/src/index.ts";