- requests.makeMultipleRetryRequest(
- { method: 'POST', path: '/api/' + constants.API_VERSION + '/pods/', data: data },
-
- podsList,
-
- // Callback called after each request
- function eachRequest (err, response, body, url, pod, callbackEachRequest) {
- // We add the pod if it responded correctly with its public certificate
- if (!err && response.statusCode === 200) {
- Pods.add({ url: pod.url, publicKey: body.cert, score: constants.FRIEND_BASE_SCORE }, function (err) {
- if (err) {
- logger.error('Error with adding %s pod.', pod.url, { error: err })
- return callbackEachRequest()
- }
-
- videos.createRemoteVideos(body.videos, function (err) {
- if (err) {
- logger.error('Error with adding videos of pod.', pod.url, { error: err })
- return callbackEachRequest()
- }
-
- logger.debug('Adding remote videos from %s.', pod.url, { videos: body.videos })
- return callbackEachRequest()
- })
- })
- } else {
- logger.error('Error with adding %s pod.', pod.url, { error: err || new Error('Status not 200') })
- return callbackEachRequest()
- }
- },
+ requests.makeRetryRequest(params, function (err, res, body) {
+ if (err) {
+ logger.error('Error with adding %s pod.', pod.url, { error: err })
+ // Don't break the process
+ return callbackEach()
+ }