ibm-blockchain-js
Advanced tools
Comparing version 1.2.6 to 1.2.7
@@ -12,4 +12,4 @@ 'use strict'; | ||
/* | ||
Version: 0.6.5 | ||
Updated: 5/23/2015 | ||
Version: 0.6.6 | ||
Updated: 8/05/2016 | ||
----------------------------------------------------------------- | ||
@@ -96,3 +96,3 @@ Use: var rest = require('./rest'); | ||
//main http request builder/handler/thingy | ||
function http(options, parameters, body){ | ||
function http(options, parameters, body, attempt){ | ||
var acceptJson = false, jQuery = false, nodeJs = false, http, http_txt = '', goodJSON = false; | ||
@@ -104,2 +104,3 @@ var ids = 'abcdefghijkmnopqrstuvwxyz'; | ||
if(!attempt || isNaN(attempt)) attempt = 1; //defaults to attempt # 1 | ||
options = mergeBtoA(default_options, options); | ||
@@ -217,8 +218,15 @@ | ||
request.on('error', function(e) { //handle error event | ||
if(!options.quiet) logger.error(http_txt + ' Error - unknown issue with request: ', e); //catch failed request (failed DNS lookup and such) | ||
failure(500, null, e); | ||
if(e.code === 'ECONNRESET' && attempt < 8) { //try ECONNRESET's again | ||
if(!options.quiet) logger.warn(http_txt + ' Warning - detected ECONNRESET, will try HTTP req again. attempt:' + attempt); | ||
attempt++; | ||
return setTimeout(function(){ http(options, parameters, body); }, 250 * Math.pow(2, attempt)); | ||
} | ||
else { | ||
if(!options.quiet) logger.error(http_txt + ' Error - unknown issue with request: ', e); //catch failed request (failed DNS lookup and such) | ||
failure(500, null, e); | ||
} | ||
}); | ||
request.setTimeout(Number(options.timeout) || default_options.timeout); | ||
request.on('timeout', function(){ //handle time out event | ||
request.on('timeout', function(){ //handle time out events | ||
if(!options.quiet) logger.error(http_txt + ' Error - request timed out'); | ||
@@ -225,0 +233,0 @@ failure(408, null, 'Request timed out'); |
{ | ||
"name": "ibm-blockchain-js", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "A library for easily interacting with IBM Blockchain.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92944
1430