-
Notifications
You must be signed in to change notification settings - Fork 1
Lag
do- edited this page Aug 29, 2024
·
12 revisions
Lag is a companion class to JobSource for setting an extra delay before creating a new Job.
Basically, this is an array of possible (strictly ascending) delay values, in milliseconds, from which the one is fetched, depending on the (severity) level, increasing with each botched job and reset to zero after the first success.
const lag = new Lag ([0, 10, 100, Infinity])The only parameter corresponds to the values property.`
| Name | Type | Default | Description |
|---|---|---|---|
jobSource |
JobSource | Write only property, the setter actually subscribes the Lag instance to the jobSource's events |
|
level |
Number |
0 |
The current lag level |
values |
[Number] |
[0] |
Possible lag values |
This method is registered with the jobSource's job-error event. In the base implementation, increases level by 1 unless it causes values oferflow, otherwise does nothing.
This method is registered with the jobSource's job-end and reset events. In the base implementation, resets level to 0.
Overriding Object.prototype.valueOf(), returns values [level].