1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 18:29:27 +02:00

Create a constants module to easily modify some constants in a test

instance for example.
This commit is contained in:
Chocobozzz 2015-12-14 21:09:25 +01:00
parent 1d7974c758
commit 656ea8f70e
7 changed files with 58 additions and 34 deletions

View file

@ -10,6 +10,7 @@
var replay = require('request-replay')
var ursa = require('ursa')
var constants = require('./constants')
var logger = require('./logger')
var utils = {}
@ -31,15 +32,13 @@
}
logger.debug('Make retry requests to %s.', to_pod.url)
// Default 10 but in tests we want to be faster
var retries = utils.isTestInstance() ? 2 : 10
replay(
request.post(params, function (err, response, body) {
callbackEach(err, response, body, params.url, to_pod)
}),
{
retries: retries,
retries: constants.REQUEST_RETRIES,
factor: 3,
maxTimeout: Infinity,
errorCodes: [ 'EADDRINFO', 'ETIMEDOUT', 'ECONNRESET', 'ESOCKETTIMEDOUT', 'ENOTFOUND', 'ECONNREFUSED' ]
@ -195,9 +194,5 @@
process.kill(-webtorrent_process.pid)
}
utils.isTestInstance = function () {
return (process.env.NODE_ENV === 'test')
}
module.exports = utils
})()