Skip to content

Commit

Permalink
Merge 743720d into df6cbc2
Browse files Browse the repository at this point in the history
  • Loading branch information
badaldesai committed Feb 19, 2020
2 parents df6cbc2 + 743720d commit 68b0ea2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
4 changes: 4 additions & 0 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v2.2.7 - 2020/02/19

* Added backoff mechanism to any request called with setting totalTimeout.

# v2.2.6 - 2020/01/08

* Added backoff mechanism to any request called with setting totalTimeout.
Expand Down
8 changes: 8 additions & 0 deletions lib/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ module.exports = (function (self) {
outputOptions.timeout = parseInt(inputOptions.timeout, 10);
}

if (!self.isEmpty(inputOptions.totalTimeout) && !isNaN(inputOptions.totalTimeout)) {
outputOptions.totalTimeout = parseInt(inputOptions.totalTimeout, 10);
}

if (!self.isEmpty(inputOptions.initialDelay) && !isNaN(inputOptions.initialDelay)) {
outputOptions.initialDelay = parseInt(inputOptions.initialDelay, 10);
}

return outputOptions;
};

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playnetwork-sdk",
"version": "2.2.6",
"version": "2.2.7",
"contributors": [
{
"name": "Joshua Thomas",
Expand Down
11 changes: 10 additions & 1 deletion test/lib/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ describe('validation', () => {
port : 8080,
rejectUnauthorized : true,
secure : true,
timeout : 60000
timeout : 60000,
totalTimeout: 5000,
initialDelay: 50
},
outputOptions = validation.applyOptionalParameters(inputOptions);

Expand All @@ -45,6 +47,10 @@ describe('validation', () => {
outputOptions.rejectUnauthorized.should.equal(true);
outputOptions.should.have.property('timeout');
outputOptions.timeout.should.equal(60000);
outputOptions.should.have.property('totalTimeout');
outputOptions.totalTimeout.should.equal(5000);
outputOptions.should.have.property('initialDelay');
outputOptions.initialDelay.should.equal(50);

should.not.exist(outputOptions.host);
should.not.exist(outputOptions.secure);
Expand Down Expand Up @@ -81,6 +87,9 @@ describe('validation', () => {
outputOptions.secure.should.equal(true);
outputOptions.should.have.property('timeout');
outputOptions.timeout.should.equal(60000);

should.not.exist(outputOptions.totalTimeout);
should.not.exist(outputOptions.initialDelay);
});
});

Expand Down

0 comments on commit 68b0ea2

Please sign in to comment.