Class: QueueWorker

workers/QueueWorker~QueueWorker

new QueueWorker()

Properties:
Name Type Attributes Default Description
concurrency Number <optional>
1

The concurrency value

Source:

Extends

Methods

add()

Overrides:
Source:
Throws:

if task has no start method

Type
TypeError

kill(Signal)

Send a signal to tasks

Parameters:
Name Type Description
Signal Number
Inherited From:
Source:
See:
  • ChildProcess#signal

onExit(name) → {function}

Registers an exit listener

Parameters:
Name Type Description
name String

the task name

Inherited From:
Source:
Returns:

The listener that deletes an ended task

Type
function

remove(name) → {Promise}

Removes a worker by name

Parameters:
Name Type Description
name String
Inherited From:
Source:
Returns:

resolves when the task exit event is fired

Type
Promise

run(Task)

Runs tasks in the stack Tasks must exit to fullfil the promise, they run in concurrency

Parameters:
Name Type Description
Task

...tasks if none provided the whole stack will run

Source:
See:
  • options.concurrency
Returns:

Promise resolves when every task exited

send() → {Promise}

send a message on every task

Inherited From:
Source:
Returns:

resolves when every task received the message

Type
Promise

start(Signal)

Starts every tasks

Parameters:
Name Type Description
Signal Number
Inherited From:
Source:
See:
  • ChildProcess#signal

task(name) → {Task}

Get a task by name

Parameters:
Name Type Description
name String
Inherited From:
Source:
Returns:
Type
Task