Socket
Socket
Sign inDemoInstall

@comparaonline/backoff

Package Overview
Dependencies
2
Maintainers
16
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @comparaonline/backoff

Simple method to retry and backoff an observable with errors


Version published
Weekly downloads
52
increased by52.94%
Maintainers
16
Install size
8.03 kB
Created
Weekly downloads
 

Readme

Source

backoff

Simple backoff method to retry failed observables.

It takes two arguments, maxTries and ms, the amount of attempts and the number of milliseconds that will be waited after the first failure. Any successive attempts the method will backoff for the specified ms times the next power of 2

Usage:

import { from } from 'rxjs';
import { backoff } from '@comparaonline/backoff';

const result = from(axios('http://sometimesfails.com')).pipe(
  backoff(3, 10000)
).toPromise();

result will either resolve correctly or retry two more times if it fails, waiting 10 seconds the first time, and 40 the second time. If it fails a third time, it will be rejected.

Keywords

FAQs

Last updated on 23 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc