aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.js')
-rw-r--r--src/utils.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/utils.js b/src/utils.js
index 30edcd0e9..5880c6c90 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -10,6 +10,7 @@
10 var replay = require('request-replay') 10 var replay = require('request-replay')
11 var ursa = require('ursa') 11 var ursa = require('ursa')
12 12
13 var constants = require('./constants')
13 var logger = require('./logger') 14 var logger = require('./logger')
14 15
15 var utils = {} 16 var utils = {}
@@ -31,15 +32,13 @@
31 } 32 }
32 33
33 logger.debug('Make retry requests to %s.', to_pod.url) 34 logger.debug('Make retry requests to %s.', to_pod.url)
34 // Default 10 but in tests we want to be faster
35 var retries = utils.isTestInstance() ? 2 : 10
36 35
37 replay( 36 replay(
38 request.post(params, function (err, response, body) { 37 request.post(params, function (err, response, body) {
39 callbackEach(err, response, body, params.url, to_pod) 38 callbackEach(err, response, body, params.url, to_pod)
40 }), 39 }),
41 { 40 {
42 retries: retries, 41 retries: constants.REQUEST_RETRIES,
43 factor: 3, 42 factor: 3,
44 maxTimeout: Infinity, 43 maxTimeout: Infinity,
45 errorCodes: [ 'EADDRINFO', 'ETIMEDOUT', 'ECONNRESET', 'ESOCKETTIMEDOUT', 'ENOTFOUND', 'ECONNREFUSED' ] 44 errorCodes: [ 'EADDRINFO', 'ETIMEDOUT', 'ECONNRESET', 'ESOCKETTIMEDOUT', 'ENOTFOUND', 'ECONNREFUSED' ]
@@ -195,9 +194,5 @@
195 process.kill(-webtorrent_process.pid) 194 process.kill(-webtorrent_process.pid)
196 } 195 }
197 196
198 utils.isTestInstance = function () {
199 return (process.env.NODE_ENV === 'test')
200 }
201
202 module.exports = utils 197 module.exports = utils
203})() 198})()