Module: strategies/WeightedStrategy

The Weighted Strategy for the CloudWorker Increments a number when each task gets called, the next task will get the one with the lowest score

This strategy resides in memory and resolves promises to be used with redis or another Queue/Set score provider

Source:

Members

(static) queue

Properties:
Name Type Description
Queue Array
Source:

Methods

(static) end(name) → {Promise}

Ends a task, decrements the score

Parameters:
Name Type Description
name String
Source:
Returns:
Type
Promise

(static) get(name) → {Object}

Get the queue element by name

Parameters:
Name Type Description
name String
Source:
Returns:

the task

Type
Object

(static) next() → {Promise}

Returns the next available task

Source:
Returns:

Resolves the task name

Type
Promise

(static) push(name) → {Promise}

Adds a task to the queue

Parameters:
Name Type Description
name String
Source:
Returns:
Type
Promise

(static) remove(Name)

Removes a task from the queue by name

Parameters:
Name Type Description
Name String
Source:

(static) start(name) → {Promise}

Starts a task, increments the score

Parameters:
Name Type Description
name String
Source:
Returns:
Type
Promise