Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backoff

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backoff - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

6

CHANGES.md
# Changelog
## 2.2.0
- To match `Backoff` default behavior, `FunctionCall` no longer sets a
default failAfter of 5, i.e. the maximum number of backoffs is now
unbounded by default.
## 2.1.0

@@ -4,0 +10,0 @@

10

lib/backoff.js

@@ -45,4 +45,4 @@ /*

* Starts a backoff operation.
* @param err Optional paramater to let listeners know why the backoff
* operation what started.
* @param err Optional paramater to let the listeners know why the backoff
* operation was started.
*/

@@ -65,3 +65,3 @@ Backoff.prototype.backoff = function(err) {

/**
* Backoff completion handler.
* Handles the backoff timeout completion.
* @private

@@ -76,4 +76,4 @@ */

/**
* Stops any backoff operation and resets the backoff
* delay to its inital value.
* Stops any backoff operation and resets the backoff delay to its inital
* value.
*/

@@ -80,0 +80,0 @@ Backoff.prototype.reset = function() {

@@ -48,2 +48,3 @@ /*

this.strategy_ = null;
this.failAfter_ = -1;

@@ -67,8 +68,2 @@ this.called_ = false;

/**
* Default number of backoffs.
* @private
*/
FunctionCall.prototype.failAfter_ = 5;
/**
* Sets the backoff strategy.

@@ -138,4 +133,7 @@ * @param strategy The backoff strategy to use.

this.backoff_.on('backoff', this.handleBackoff_.bind(this));
this.backoff_.failAfter(this.failAfter_);
if (this.failAfter_ > 0) {
this.backoff_.failAfter(this.failAfter_);
}
this.called_ = true;

@@ -142,0 +140,0 @@ this.doCall_();

{
"name": "backoff",
"description": "Fibonacci and exponential backoffs.",
"version": "2.1.0",
"version": "2.2.0",
"author": "Mathieu Turcotte <turcotte.mat@gmail.com>",

@@ -17,3 +17,3 @@ "keywords": ["backoff", "retry", "fibonacci", "exponential"],

"scripts": {
"pretest": "node_modules/jshint/bin/jshint lib/ lib/ tests/ examples/ index.js",
"pretest": "node_modules/jshint/bin/jshint lib/ tests/ examples/ index.js",
"test": "node_modules/nodeunit/bin/nodeunit tests/"

@@ -20,0 +20,0 @@ },

@@ -271,5 +271,7 @@ # Backoff for Node.js [![Build Status](https://secure.travis-ci.org/MathieuTurcotte/node-backoff.png?branch=master)](http://travis-ci.org/MathieuTurcotte/node-backoff)

Sets the maximum number of backoffs before the call is aborted. This method
should be called before `call.call()`.
Sets the maximum number of backoffs before the call is aborted. By default,
there is no limit on the number of backoffs that can be performed.
This method should be called before `call.call()`.
#### call.getResults()

@@ -276,0 +278,0 @@

@@ -70,3 +70,10 @@ /*

"failAfter should overwrite the maximum number of backoffs": function(test) {
"failAfter should not be set by default": function(test) {
var call = new FunctionCall(this.wrappedFn, [], this.callback);
call.start(this.backoffFactory);
test.equal(0, this.backoff.failAfter.callCount);
test.done();
},
"failAfter should be used as the maximum number of backoffs": function(test) {
var failAfterValue = 99;

@@ -73,0 +80,0 @@ var call = new FunctionCall(this.wrappedFn, [], this.callback);

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