0.1.0 • Published 1 year ago

@sosimple/retry v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Retry (API Doc)

A library for retrying failed I/O operations.

Example:

import { retry, fixedDelay } from "@sosimple/retry";

class MyService {

  @retry({
    // Fail after three attempts.
    retryLimit: 3,
    // Fail if attempts take more than three seconds.
    timeLimit: 3000,
    // Delay for 100 milliseconds between attempts.
    delayer: fixedDelay(100),
  })
  async makeNetworkRequest(): Promise<void> {
    // The @retry(...) annotation will call this method
    // as long as it throws exceptions, then returns
    // the last successful result.
  }
}