new CloudWorker()
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
strategy |
Strategy |
<optional> |
Strategy | The round robin strategy |
- Source:
Extends
Methods
add()
- Overrides:
- Source:
Throws:
TypeError if task has no start method
call()
Call call
on the next strategy available task
get()
Call get
on the next strategy available task
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 |
- Overrides:
- 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()
Start tasks
- Source:
Returns:
Promise resolves when every task is started
send(event)
Send a message to the next available task
Parameters:
Name | Type | Description |
---|---|---|
event |
String | |
...args |
Arguments |
- Overrides:
- Source:
Throws:
ReferenceError
Returns:
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