function WorkerPoolPlugin
Since 0.1.0
WorkerPoolPlugin(options?: WorkerPoolPluginOptions): IPlugin

Creates the WorkerPoolPlugin.

Registers an IWorkerPool under CAPABILITIES.WORKER_POOL. Single instance only (duplicate registration throws at startup via the resolver). On runtimes without worker threads (Cloudflare Workers) the plugin still registers; run() then throws WorkerPoolUnavailableError.

Examples

Example 1

import { WorkerPoolPlugin } from '@setu-ts/worker-pool-plugin';

app.register(WorkerPoolPlugin({ taskTimeoutMs: 10_000 }));

Parameters

optional
options: WorkerPoolPluginOptions

Plugin configuration

Return Type

IPlugin

The plugin instance

Usage

import { WorkerPoolPlugin } from "worker-pool-plugin/src/index.ts";