import ExponentialBackoff from '@cansat-icarus/capture-lib/src/lib/backoff-wrapper.js'
ExponentialBackoff
Extends:
A wrapper over the ExponentialBackoffStrategy from the backoff module.
Constructor Summary
Public Constructor | ||
public |
Constructor. |
Member Summary
Private Members | ||
private |
Number of previous failed attempts. |
|
private |
_strategy: ExponentialBackoffStrategy ExponentialBackoffStrategy instance. |
|
private |
_timeoutID: TimeoutID Backoff timeout ID. |
Method Summary
Public Methods | ||
public |
backoff() Signals that we tried executing the protected routine and failed, or that we want to start the process. |
|
public |
reset() Resets failed attempt number and cancels a possible pending action (routine execution after backoff). |
|
public |
success() Used to signal the routine was successful. |
Public Constructors
Private Members
Public Methods
public backoff() source
Signals that we tried executing the protected routine and failed, or that we want to start the process.
Emit:
* |
backoff(_backoffNumber, delay) delay is how much time will pass before we try executing the routine. |
public reset() source
Resets failed attempt number and cancels a possible pending action (routine execution after backoff).