Socket
Socket
Sign inDemoInstall

oibackoff

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.2.0

8

package.json
{
"name": "oibackoff",
"description": "Incremental backoff for any function.",
"version": "0.1.0",
"description": "Incremental backoff flow-control for any : fn(function(err, data) { ... });",
"version": "0.2.0",
"author": {

@@ -41,3 +41,5 @@ "name": "Andrew Chilton",

"exponentail",
"linear"
"linear",
"control flow",
"flow"
],

@@ -44,0 +46,0 @@ "scripts": {

@@ -13,7 +13,9 @@ ```

oibackoff - backoff functionality for any : fn(function(err, data) { ... });
oibackoff - incremental backoff flow-control for any : fn(function(err, data) { ... });
[![Build Status](https://secure.travis-ci.org/appsattic/oibackoff.png?branch=master)](http://travis-ci.org/appsattic/oibackoff)
## Features ##
* three different backoff algorithsm: exponential, fibonacci and linear
* three different backoff algorithms: exponential, fibonacci and linear
* max number of tries

@@ -23,3 +25,3 @@ * max time to wait for any retry

You code can stay the same plus you also get extra information about intermediate errors.
Your code can stay the same plus you also get extra information about intermediate errors.

@@ -46,3 +48,4 @@ ## Examples ##

Using exponential backoff, with a maxium of 5 tries, with delays of 0.2, 0.4, 0.8, 1.6 and 3.2 seconds:
Using exponential backoff, with a maxium of 5 tries, with delays of 0.2, 0.4, 0.8, 1.6 and 3.2 seconds is fairly
similar and you can reuse the 'backoff' function many times:

@@ -69,3 +72,3 @@ ```

* 'err' contains the last error encountered (if maxTries was reached)
* 'err' contains the last error encountered (if maxTries was reached without success)
* 'addresses' contrains the same as the original upon success, or null if all attempts failed

@@ -96,2 +99,10 @@ * 'priorErrors' is informational and you may ignore it or use it to help you diagnose problems

### maxDelay ###
No Default.
If your chosen backoff strategy reaches a point which is above this number, then each succesive retry will top-out at
'maxDelay' e.g. if you choose 'exponential', with a delayRatio of 1 and maxTries at 10, the retry delays will be 1, 2,
4, 8, 10, 10, ... (instead of 1, 2, 4, 8, 16, 32, ...).
## Example Backoff Stategies ##

@@ -114,3 +125,3 @@

// 0.5, 1.0, 1.5, 2.5, 4, ...
// 0.5, 0.5, 1.0, 1.5, 2.5, 4, ...
var backoff = oibackoff.backoff({

@@ -117,0 +128,0 @@ algorithm : 'fibonacci',

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