Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Retrier

Utility class for retrying operations. Usage example:

         const funcToRetry: () => Promise<boolean> = async () => {
             let hasSucceeded = false;
             // ...
             // custom logic
             // ...
             return hasSucceeded;
         }
         const retrierSuccess = await Retrier.Create(funcToRetry)
             .Setup({
                 retries: 3,
                 retryIntervalMs: 1,
                 timeoutMs: 1000
             })
             .Run();

Hierarchy

  • Retrier

Index

Methods

Methods

Run

  • Run(): Promise<boolean>
  • Public method that starts the Retrier

    throws

    Error if the Retrier is already started.

    Returns Promise<boolean>

    A boolean value that indicates if the process has been succeeded.

Setup

  • Method to override the default Retrier settings.

    throws

    Error if the Retrier is running.

    Parameters

    Returns this

    the Retrier instance

Static Create

  • Create(callback: function): Retrier
  • Factory method for creating a Retrier

    Parameters

    • callback: function

      The method that will be invoked on each try

        • (): Promise<boolean>
        • Returns Promise<boolean>

    Returns Retrier

Generated using TypeDoc