Function retry

  • make function retry-able

    e.g. if maxRetryCount is 3, it will run 3 times at most (include the first one), and return the final error.

    Type Parameters

    Parameters

    • runner: T

      async function, return promise

    • maxRetryCount: number = 3

      the maximum number of times a runner should retry, default is 3

    • retryAfterMSecond: number = 0

      (async function required, for sync function, this parameter will not be applied) the wait milliseconds before retry, default is zero

    Returns T

    Since

    5.14.0