1.0.2 • Published 11 months ago

@exodus/simple-retry v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@exodus/simple-retry

Install

yarn add @exodus/simple-retry

Usage

import { retry } from '@exodus/simple-retry'

const broadcastTxWithRetry = retry(broadcastFunction, { delayTimesMs: ['10s'] })
const result = await broadcastTxWithRetry(plainTx)

It is possible to trap specific errors and mark them as final when retrying is not needed, like:

const broadcastTxWithRetry = retry(
  async (plainTx) => {
    try {
      return await broadcastFunction(plainTx)
    } catch (e) {
      if (/specific-final-error/i.test(e.message)) e.finalError = true
      throw e
    }
  },
  { delayTimesMs: ['10s'] }
)
1.0.2

11 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago