New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@comparaonline/backoff

Package Overview
Dependencies
Maintainers
16
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@comparaonline/backoff

Simple method to retry and backoff an observable with errors

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
16
Created
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

Package last updated on 23 Jan 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc