Home Reference Source Repository
public class | source

ExponentialBackoff

Extends:

events~EventEmitter → ExponentialBackoff

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

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

Used to signal the routine was successful.

Public Constructors

public constructor() source

Constructor.

Private Members

private _backoffNumber: Number source

Number of previous failed attempts.

private _strategy: ExponentialBackoffStrategy source

ExponentialBackoffStrategy instance.

private _timeoutID: TimeoutID source

Backoff timeout ID.

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).

public success() source

Used to signal the routine was successful. This resets the wrapper.

Emit:

*

success

See: