Skip to main content
zerotal

Documentation


Documentation / @zerotal/queue / index / WorkerPoolOptions

Interface: WorkerPoolOptions

Defined in: queue/src/WorkerPool.ts:4

Properties

size

size: number

Defined in: queue/src/WorkerPool.ts:6

Number of OS threads to spawn.


bootstrapPath?

optional bootstrapPath?: string

Defined in: queue/src/WorkerPool.ts:12

Optional absolute path or file URL to a module that imports+registers all job classes. When omitted, the worker thread discovers jobs by convention (imports every app/jobs/*.ts). Set it only to override that with an explicit bootstrap.


maxPending?

optional maxPending?: number

Defined in: queue/src/WorkerPool.ts:22

Most jobs allowed to wait in memory for a free thread. Default: size * 64.

A job sitting in this backlog is already claimed — the driver has reserved it and is counting down its visibility timeout. Queue more than the pool can work through and those jobs are reclaimed and executed a second time while the first copy is still waiting its turn. Past the cap, run() reports failure immediately so the job goes back to the driver instead of aging out.


maxRespawns?

optional maxRespawns?: number

Defined in: queue/src/WorkerPool.ts:27

How many times a slot may respawn after its worker dies before the pool gives up on it. Default: 5. A worker whose script throws on load would otherwise respawn forever.