aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/friends.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-18 17:17:52 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-18 17:17:52 +0200
commit1a42c9e2c0fb64cdbebd81b311736e752f591e0a (patch)
treee893324d730878257491428ffca634a92f1eea05 /server/lib/friends.js
parentd56ec0d4129160a6e3b51ace3766bb325db1f101 (diff)
downloadPeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.tar.gz
PeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.tar.zst
PeerTube-1a42c9e2c0fb64cdbebd81b311736e752f591e0a.zip
Server: udpate async to 2.0.0
Diffstat (limited to 'server/lib/friends.js')
-rw-r--r--server/lib/friends.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/lib/friends.js b/server/lib/friends.js
index a85f4e19a..6e1516b94 100644
--- a/server/lib/friends.js
+++ b/server/lib/friends.js
@@ -1,10 +1,13 @@
1'use strict' 1'use strict'
2 2
3const async = require('async')
4const config = require('config') 3const config = require('config')
4const each = require('async/each')
5const eachLimit = require('async/eachLimit')
6const eachSeries = require('async/eachSeries')
5const fs = require('fs') 7const fs = require('fs')
6const mongoose = require('mongoose') 8const mongoose = require('mongoose')
7const request = require('request') 9const request = require('request')
10const waterfall = require('async/waterfall')
8 11
9const constants = require('../initializers/constants') 12const constants = require('../initializers/constants')
10const logger = require('../helpers/logger') 13const logger = require('../helpers/logger')
@@ -57,7 +60,7 @@ function makeFriends (callback) {
57 60
58 const urls = config.get('network.friends') 61 const urls = config.get('network.friends')
59 62
60 async.eachSeries(urls, function (url, callbackEach) { 63 eachSeries(urls, function (url, callbackEach) {
61 computeForeignPodsList(url, podsScore, callbackEach) 64 computeForeignPodsList(url, podsScore, callbackEach)
62 }, function (err) { 65 }, function (err) {
63 if (err) return callback(err) 66 if (err) return callback(err)
@@ -77,7 +80,7 @@ function quitFriends (callback) {
77 // Flush pool requests 80 // Flush pool requests
78 Request.flush() 81 Request.flush()
79 82
80 async.waterfall([ 83 waterfall([
81 function getPodsList (callbackAsync) { 84 function getPodsList (callbackAsync) {
82 return Pod.list(callbackAsync) 85 return Pod.list(callbackAsync)
83 }, 86 },
@@ -92,7 +95,7 @@ function quitFriends (callback) {
92 // Announce we quit them 95 // Announce we quit them
93 // We don't care if the request fails 96 // We don't care if the request fails
94 // The other pod will exclude us automatically after a while 97 // The other pod will exclude us automatically after a while
95 async.eachLimit(pods, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) { 98 eachLimit(pods, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) {
96 requestParams.toPod = pod 99 requestParams.toPod = pod
97 requests.makeSecureRequest(requestParams, callbackEach) 100 requests.makeSecureRequest(requestParams, callbackEach)
98 }, function (err) { 101 }, function (err) {
@@ -118,7 +121,7 @@ function quitFriends (callback) {
118 }, 121 },
119 122
120 function removeTheRemoteVideos (videosList, callbackAsync) { 123 function removeTheRemoteVideos (videosList, callbackAsync) {
121 async.each(videosList, function (video, callbackEach) { 124 each(videosList, function (video, callbackEach) {
122 video.remove(callbackEach) 125 video.remove(callbackEach)
123 }, callbackAsync) 126 }, callbackAsync)
124 } 127 }
@@ -212,7 +215,7 @@ function makeRequestsToWinningPods (cert, podsList, callback) {
212 // Flush pool requests 215 // Flush pool requests
213 Request.forceSend() 216 Request.forceSend()
214 217
215 async.eachLimit(podsList, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) { 218 eachLimit(podsList, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) {
216 const params = { 219 const params = {
217 url: pod.url + '/api/' + constants.API_VERSION + '/pods/', 220 url: pod.url + '/api/' + constants.API_VERSION + '/pods/',
218 method: 'POST', 221 method: 'POST',