Skip to main content

Interface: WorkerOptions

Defined in: core/src/threads/ThreadPool.ts:26

Describes the various options that can be used when creating worker threads.

Properties

allowTs?

optional allowTs?: boolean

Defined in: core/src/threads/ThreadPool.ts:34

Set to true to enable support for importing TypeScript modules in the worker. Default is true.


args?

optional args?: any

Defined in: core/src/threads/ThreadPool.ts:28

The list of initialization arguments to pass into the worker thread.


entry?

optional entry?: string

Defined in: core/src/threads/ThreadPool.ts:30

The path to the entry file create a worker thread from. Default is ThreadWorkerEntry.js.


restartOnExit?

optional restartOnExit?: boolean

Defined in: core/src/threads/ThreadPool.ts:32

Indicates if a worker thread should automatically be restarted on exit.


startupTimeoutMs?

optional startupTimeoutMs?: number

Defined in: core/src/threads/ThreadPool.ts:43

The maximum amount of time, in milliseconds, to wait for all worker threads to report readiness before start() rejects. Default is ThreadPool.START_TIMEOUT_MS. Guards against a worker whose entry script hangs during its own setup and never posts online/emits an error, which would otherwise leave the returned promise hanging forever with no way to detect or recover.


worker?

optional worker?: string

Defined in: core/src/threads/ThreadPool.ts:36

The path to the worker file. This must be set when using ThreadWorkerEntry as the default entry file.