]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - src/utils.js
Finalise the join in a network and add the ability to quit it
[github/Chocobozzz/PeerTube.git] / src / utils.js
index 5880c6c90409e08ff67febde7fbbe9a22e82d41a..176648a312b0a7229f711b9585c41d067300055f 100644 (file)
@@ -56,7 +56,7 @@
   utils.makeMultipleRetryRequest = function (all_data, pods, callbackEach, callback) {
     if (!callback) {
       callback = callbackEach
-      callbackEach = function () {}
+      callbackEach = null
     }
 
     var url = http + '://' + host + ':' + port
     // Make a request for each pod
     async.each(pods, function (pod, callback_each_async) {
       function callbackEachRetryRequest (err, response, body, url, pod) {
-        callbackEach(err, response, body, url, pod, function () {
+        if (callbackEach !== null) {
+          callbackEach(err, response, body, url, pod, function () {
+            callback_each_async()
+          })
+        } else {
           callback_each_async()
-        })
+        }
       }
 
       var params = {