runQueueWorker
Purpose and behavior
Section titled “Purpose and behavior”Claim jobs for the registered handlers and run them one at a time until signal aborts, renewing each lease at every third of leaseMs. A thrown error or a result with error marks the job failed; a lost lease or a cancellation aborts the handler’s signal and stores nothing. Resolves once signal aborts and rejects when a queue operation fails.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”optionsRequiredQueueWorkerOptionsQueue, worker name, handlers, stop signal, and lease and polling timings.options.queueRequiredTaskQueueQueue the worker claims jobs from and reports results to.options.workerRequiredstringWorker name recorded on each claimed job, 1 to 512 characters; give each process its own.options.handlersRequiredReadonly<Record<string, QueueHandler>>Handlers by name, 1 to 100; the worker claims only jobs whose handler is listed here.options.signalRequiredAbortSignalStops the worker: runQueueWorker() resolves and the running handler’s signal aborts. That job stays active until its lease expires.options.leaseMsOptionalnumber | undefinedLease duration in milliseconds, default 30000, from 30 to 300000; renewed at every third of it.options.pollMsOptionalnumber | undefinedWait in milliseconds after finding no eligible job, default 250; must be positive.