Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/backoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

var events = require('events');
var precond = require('precond');
var util = require('util');
var inherits = require('inherits');

// A class to hold the state of a backoff operation. Accepts a backoff strategy
// to generate the backoff delays.
Expand All @@ -20,7 +20,7 @@ function Backoff(backoffStrategy) {
backoff: this.onBackoff_.bind(this)
};
}
util.inherits(Backoff, events.EventEmitter);
inherits(Backoff, events.EventEmitter);

// Sets a limit, greater than 0, on the maximum number of backoffs. A 'fail'
// event will be emitted when the limit is reached.
Expand Down
4 changes: 2 additions & 2 deletions lib/function_call.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

var events = require('events');
var precond = require('precond');
var util = require('util');
var inherits = require('inherits');

var Backoff = require('./backoff');
var FibonacciBackoffStrategy = require('./strategy/fibonacci');
Expand All @@ -29,7 +29,7 @@ function FunctionCall(fn, args, callback) {

this.state_ = FunctionCall.State_.PENDING;
}
util.inherits(FunctionCall, events.EventEmitter);
inherits(FunctionCall, events.EventEmitter);

// States in which the call can be.
FunctionCall.State_ = {
Expand Down
4 changes: 2 additions & 2 deletions lib/strategy/exponential.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2012 Mathieu Turcotte
// Licensed under the MIT license.

var util = require('util');
var inherits = require('inherits');
var precond = require('precond');

var BackoffStrategy = require('./strategy');
Expand All @@ -20,7 +20,7 @@ function ExponentialBackoffStrategy(options) {
this.factor_ = options.factor;
}
}
util.inherits(ExponentialBackoffStrategy, BackoffStrategy);
inherits(ExponentialBackoffStrategy, BackoffStrategy);

// Default multiplication factor used to compute the next backoff delay from
// the current one. The value can be overridden by passing a custom factor as
Expand Down
4 changes: 2 additions & 2 deletions lib/strategy/fibonacci.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2012 Mathieu Turcotte
// Licensed under the MIT license.

var util = require('util');
var inherits = require('inherits');

var BackoffStrategy = require('./strategy');

Expand All @@ -11,7 +11,7 @@ function FibonacciBackoffStrategy(options) {
this.backoffDelay_ = 0;
this.nextBackoffDelay_ = this.getInitialDelay();
}
util.inherits(FibonacciBackoffStrategy, BackoffStrategy);
inherits(FibonacciBackoffStrategy, BackoffStrategy);

FibonacciBackoffStrategy.prototype.next_ = function() {
var backoffDelay = Math.min(this.nextBackoffDelay_, this.getMaxDelay());
Expand Down
1 change: 0 additions & 1 deletion lib/strategy/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license.

var events = require('events');
var util = require('util');

function isDef(value) {
return value !== undefined && value !== null;
Expand Down
66 changes: 36 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
{
"name": "backoff",
"description": "Fibonacci and exponential backoffs.",
"version": "2.5.0",
"license": "MIT",
"author": "Mathieu Turcotte <[email protected]>",
"keywords": ["backoff", "retry", "fibonacci", "exponential"],
"repository": {
"type": "git",
"url": "https://github.com/MathieuTurcotte/node-backoff.git"
},
"dependencies": {
"precond": "0.2"
},
"devDependencies": {
"sinon": "1.10",
"nodeunit": "0.9"
},
"scripts": {
"docco" : "docco lib/*.js lib/strategy/* index.js",
"pretest": "jshint lib/ tests/ examples/ index.js",
"test": "node_modules/nodeunit/bin/nodeunit tests/"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"index.js",
"lib",
"tests"
]
"name": "backoff",
"description": "Fibonacci and exponential backoffs.",
"version": "2.5.0",
"license": "MIT",
"author": "Mathieu Turcotte <[email protected]>",
"keywords": [
"backoff",
"retry",
"fibonacci",
"exponential"
],
"repository": {
"type": "git",
"url": "https://github.com/MathieuTurcotte/node-backoff.git"
},
"dependencies": {
"inherits": "^2.0.3",
"precond": "0.2"
},
"devDependencies": {
"sinon": "1.10",
"nodeunit": "0.9"
},
"scripts": {
"docco": "docco lib/*.js lib/strategy/* index.js",
"pretest": "jshint lib/ tests/ examples/ index.js",
"test": "node_modules/nodeunit/bin/nodeunit tests/"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"index.js",
"lib",
"tests"
]
}