vercel / Async Retry
Licence: mit
Retrying made simple, easy and async
Stars: ✭ 1,262
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Async Retry
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (-45.32%)
Mutual labels: async, await
Sqlx
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.
Stars: ✭ 5,039 (+299.29%)
Mutual labels: async, await
Modern Async
A modern JavaScript tooling library for asynchronous operations using async/await and promises
Stars: ✭ 31 (-97.54%)
Mutual labels: async, await
Vue Skeleton Mvp
VueJs, Vuetify, Vue Router and Vuex skeleton MVP written on JavaScript using async/await built to work with API REST skeleton: https://github.com/davellanedam/node-express-mongodb-jwt-rest-api-skeleton
Stars: ✭ 406 (-67.83%)
Mutual labels: async, await
Awaitkit
The ES8 Async/Await control flow for Swift
Stars: ✭ 709 (-43.82%)
Mutual labels: async, await
Async Techniques Python Course
Async Techniques and Examples in Python Course
Stars: ✭ 314 (-75.12%)
Mutual labels: async, await
Blockly Gamepad
A Blockly extension designed to develop games (made with love ❤)
Stars: ✭ 18 (-98.57%)
Mutual labels: async, await
Asyncenumerable
Defines IAsyncEnumerable, IAsyncEnumerator, ForEachAsync(), ParallelForEachAsync(), and other useful stuff to use with async-await
Stars: ✭ 367 (-70.92%)
Mutual labels: async, await
P Iteration
Utilities that make array iteration easy when using async/await or Promises
Stars: ✭ 337 (-73.3%)
Mutual labels: async, await
Micro Router
🚉 A tiny and functional router for Zeit's Micro
Stars: ✭ 621 (-50.79%)
Mutual labels: async, await
Asyncawaitbestpractices
Extensions for System.Threading.Tasks.Task and System.Threading.Tasks.ValueTask
Stars: ✭ 693 (-45.09%)
Mutual labels: async, await
Await Of
await wrapper for easier errors handling without try-catch
Stars: ✭ 240 (-80.98%)
Mutual labels: async, await
Ws Promise Client
PROJECT MOVED: https://github.com/kdex/ws-promise
Stars: ✭ 6 (-99.52%)
Mutual labels: async, await
Csp
Communicating Sequential Processes in JavaScript
Stars: ✭ 33 (-97.39%)
Mutual labels: async, await
async-retry
Retrying made simple, easy, and async.
Usage
// Packages
const retry = require('async-retry')
const fetch = require('node-fetch')
await retry(async bail => {
// if anything throws, we retry
const res = await fetch('https://google.com')
if (403 === res.status) {
// don't retry upon 403
bail(new Error('Unauthorized'))
return
}
const data = await res.text()
return data.substr(0, 500)
}, {
retries: 5
})
API
retry(retrier : Function, opts : Object) => Promise
- The supplied function can be
async
or not. In other words, it can be a function that returns aPromise
or a value. - The supplied function receives two parameters
- A
Function
you can invoke to abort the retrying (bail) - A
Number
identifying the attempt. The absolute first attempt (before any retries) is1
.
- A
- The
opts
are passed tonode-retry
. Read its docs-
retries
: The maximum amount of times to retry the operation. Default is10
. -
factor
: The exponential factor to use. Default is2
. -
minTimeout
: The number of milliseconds before starting the first retry. Default is1000
. -
maxTimeout
: The maximum number of milliseconds between two retries. Default isInfinity
. -
randomize
: Randomizes the timeouts by multiplying with a factor between1
to2
. Default istrue
. -
onRetry
: an optionalFunction
that is invoked after a new retry is performed. It's passed theError
that triggered it as a parameter.
-
Authors
- Guillermo Rauch (@rauchg) - ZEIT
- Leo Lamprecht (@notquiteleo) - ZEIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].