Server: udpate async to 2.0.0
This commit is contained in:
parent
d56ec0d412
commit
1a42c9e2c0
|
@ -34,7 +34,7 @@
|
|||
"postinstall": "cd client && npm install"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^1.2.1",
|
||||
"async": "^2.0.0",
|
||||
"bittorrent-tracker": "^8.0.0",
|
||||
"body-parser": "^1.12.4",
|
||||
"concurrently": "^2.0.0",
|
||||
|
@ -53,7 +53,6 @@
|
|||
"morgan": "^1.5.3",
|
||||
"multer": "^1.1.0",
|
||||
"node-ipc": "^8.0.0",
|
||||
"node-sass": "^3.4.2",
|
||||
"openssl-wrapper": "^0.3.4",
|
||||
"password-generator": "^2.0.2",
|
||||
"request": "^2.57.0",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const each = require('async/each')
|
||||
const express = require('express')
|
||||
const mongoose = require('mongoose')
|
||||
const waterfall = require('async/waterfall')
|
||||
|
||||
const logger = require('../../../helpers/logger')
|
||||
const friends = require('../../../lib/friends')
|
||||
|
@ -31,7 +32,7 @@ module.exports = router
|
|||
function addPods (req, res, next) {
|
||||
const informations = req.body
|
||||
|
||||
async.waterfall([
|
||||
waterfall([
|
||||
function addPod (callback) {
|
||||
const pod = new Pod(informations)
|
||||
pod.save(function (err, podCreated) {
|
||||
|
@ -82,7 +83,7 @@ function makeFriends (req, res, next) {
|
|||
function removePods (req, res, next) {
|
||||
const url = req.body.signature.url
|
||||
|
||||
async.waterfall([
|
||||
waterfall([
|
||||
function loadPod (callback) {
|
||||
Pod.loadByUrl(url, callback)
|
||||
},
|
||||
|
@ -106,7 +107,7 @@ function removePods (req, res, next) {
|
|||
},
|
||||
|
||||
function removeTheRemoteVideos (videosList, callback) {
|
||||
async.each(videosList, function (video, callbackEach) {
|
||||
each(videosList, function (video, callbackEach) {
|
||||
video.remove(callbackEach)
|
||||
}, callback)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const each = require('async/each')
|
||||
const eachSeries = require('async/eachSeries')
|
||||
const express = require('express')
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
|
@ -32,7 +33,7 @@ function remoteVideos (req, res, next) {
|
|||
|
||||
// We need to process in the same order to keep consistency
|
||||
// TODO: optimization
|
||||
async.eachSeries(requests, function (request, callbackEach) {
|
||||
eachSeries(requests, function (request, callbackEach) {
|
||||
const videoData = request.data
|
||||
|
||||
if (request.type === 'add') {
|
||||
|
@ -72,7 +73,7 @@ function removeRemoteVideo (videoToRemoveData, fromUrl, callback) {
|
|||
logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podUrl: fromUrl })
|
||||
}
|
||||
|
||||
async.each(videosList, function (video, callbackEach) {
|
||||
each(videosList, function (video, callbackEach) {
|
||||
logger.debug('Removing remote video %s.', video.magnetUri)
|
||||
|
||||
video.remove(callbackEach)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const config = require('config')
|
||||
const express = require('express')
|
||||
const mongoose = require('mongoose')
|
||||
const multer = require('multer')
|
||||
const waterfall = require('async/waterfall')
|
||||
|
||||
const logger = require('../../../helpers/logger')
|
||||
const friends = require('../../../lib/friends')
|
||||
|
@ -85,7 +85,7 @@ function addVideo (req, res, next) {
|
|||
const videoFile = req.files.videofile[0]
|
||||
const videoInfos = req.body
|
||||
|
||||
async.waterfall([
|
||||
waterfall([
|
||||
|
||||
function insertIntoDB (callback) {
|
||||
const videoData = {
|
||||
|
@ -152,7 +152,7 @@ function listVideos (req, res, next) {
|
|||
function removeVideo (req, res, next) {
|
||||
const videoId = req.params.id
|
||||
|
||||
async.waterfall([
|
||||
waterfall([
|
||||
function getVideo (callback) {
|
||||
Video.load(videoId, callback)
|
||||
},
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const config = require('config')
|
||||
const each = require('async/each')
|
||||
const mkdirp = require('mkdirp')
|
||||
const mongoose = require('mongoose')
|
||||
const passwordGenerator = require('password-generator')
|
||||
const path = require('path')
|
||||
const series = require('async/series')
|
||||
|
||||
const checker = require('./checker')
|
||||
const logger = require('../helpers/logger')
|
||||
|
@ -19,7 +20,7 @@ const installer = {
|
|||
}
|
||||
|
||||
function installApplication (callback) {
|
||||
async.series([
|
||||
series([
|
||||
function createDirectories (callbackAsync) {
|
||||
createDirectoriesIfNotExist(callbackAsync)
|
||||
},
|
||||
|
@ -47,7 +48,7 @@ module.exports = installer
|
|||
function createDirectoriesIfNotExist (callback) {
|
||||
const storages = config.get('storage')
|
||||
|
||||
async.each(Object.keys(storages), function (key, callbackEach) {
|
||||
each(Object.keys(storages), function (key, callbackEach) {
|
||||
const dir = storages[key]
|
||||
mkdirp(path.join(__dirname, '..', '..', dir), callbackEach)
|
||||
}, callback)
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const config = require('config')
|
||||
const each = require('async/each')
|
||||
const eachLimit = require('async/eachLimit')
|
||||
const eachSeries = require('async/eachSeries')
|
||||
const fs = require('fs')
|
||||
const mongoose = require('mongoose')
|
||||
const request = require('request')
|
||||
const waterfall = require('async/waterfall')
|
||||
|
||||
const constants = require('../initializers/constants')
|
||||
const logger = require('../helpers/logger')
|
||||
|
@ -57,7 +60,7 @@ function makeFriends (callback) {
|
|||
|
||||
const urls = config.get('network.friends')
|
||||
|
||||
async.eachSeries(urls, function (url, callbackEach) {
|
||||
eachSeries(urls, function (url, callbackEach) {
|
||||
computeForeignPodsList(url, podsScore, callbackEach)
|
||||
}, function (err) {
|
||||
if (err) return callback(err)
|
||||
|
@ -77,7 +80,7 @@ function quitFriends (callback) {
|
|||
// Flush pool requests
|
||||
Request.flush()
|
||||
|
||||
async.waterfall([
|
||||
waterfall([
|
||||
function getPodsList (callbackAsync) {
|
||||
return Pod.list(callbackAsync)
|
||||
},
|
||||
|
@ -92,7 +95,7 @@ function quitFriends (callback) {
|
|||
// Announce we quit them
|
||||
// We don't care if the request fails
|
||||
// The other pod will exclude us automatically after a while
|
||||
async.eachLimit(pods, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) {
|
||||
eachLimit(pods, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) {
|
||||
requestParams.toPod = pod
|
||||
requests.makeSecureRequest(requestParams, callbackEach)
|
||||
}, function (err) {
|
||||
|
@ -118,7 +121,7 @@ function quitFriends (callback) {
|
|||
},
|
||||
|
||||
function removeTheRemoteVideos (videosList, callbackAsync) {
|
||||
async.each(videosList, function (video, callbackEach) {
|
||||
each(videosList, function (video, callbackEach) {
|
||||
video.remove(callbackEach)
|
||||
}, callbackAsync)
|
||||
}
|
||||
|
@ -212,7 +215,7 @@ function makeRequestsToWinningPods (cert, podsList, callback) {
|
|||
// Flush pool requests
|
||||
Request.forceSend()
|
||||
|
||||
async.eachLimit(podsList, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) {
|
||||
eachLimit(podsList, constants.REQUESTS_IN_PARALLEL, function (pod, callbackEach) {
|
||||
const params = {
|
||||
url: pod.url + '/api/' + constants.API_VERSION + '/pods/',
|
||||
method: 'POST',
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const each = require('async/each')
|
||||
const eachLimit = require('async/eachLimit')
|
||||
const map = require('lodash/map')
|
||||
const mongoose = require('mongoose')
|
||||
const waterfall = require('async/waterfall')
|
||||
|
||||
const constants = require('../initializers/constants')
|
||||
const logger = require('../helpers/logger')
|
||||
|
@ -136,7 +138,7 @@ function makeRequests () {
|
|||
const goodPods = []
|
||||
const badPods = []
|
||||
|
||||
async.eachLimit(Object.keys(requestsToMake), constants.REQUESTS_IN_PARALLEL, function (toPodId, callbackEach) {
|
||||
eachLimit(Object.keys(requestsToMake), constants.REQUESTS_IN_PARALLEL, function (toPodId, callbackEach) {
|
||||
const requestToMake = requestsToMake[toPodId]
|
||||
|
||||
// FIXME: mongodb request inside a loop :/
|
||||
|
@ -183,7 +185,7 @@ function makeRequests () {
|
|||
|
||||
// Remove pods with a score of 0 (too many requests where they were unreachable)
|
||||
function removeBadPods () {
|
||||
async.waterfall([
|
||||
waterfall([
|
||||
function findBadPods (callback) {
|
||||
Pod.listBadPods(function (err, pods) {
|
||||
if (err) {
|
||||
|
@ -217,7 +219,7 @@ function removeBadPods () {
|
|||
return callback(null)
|
||||
}
|
||||
|
||||
async.each(videosList, function (video, callbackEach) {
|
||||
each(videosList, function (video, callbackEach) {
|
||||
video.remove(callbackEach)
|
||||
}, function (err) {
|
||||
if (err) {
|
||||
|
@ -237,7 +239,7 @@ function removeBadPods () {
|
|||
return callback(null)
|
||||
}
|
||||
|
||||
async.each(pods, function (pod, callbackEach) {
|
||||
each(pods, function (pod, callbackEach) {
|
||||
pod.remove(callbackEach)
|
||||
}, function (err) {
|
||||
if (err) return callback(err)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const config = require('config')
|
||||
const each = require('async/each')
|
||||
const ffmpeg = require('fluent-ffmpeg')
|
||||
const fs = require('fs')
|
||||
const parallel = require('async/parallel')
|
||||
const pathUtils = require('path')
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
|
@ -90,7 +91,7 @@ VideoSchema.pre('remove', function (next) {
|
|||
)
|
||||
}
|
||||
|
||||
async.parallel(tasks, next)
|
||||
parallel(tasks, next)
|
||||
})
|
||||
|
||||
VideoSchema.pre('save', function (next) {
|
||||
|
@ -110,7 +111,7 @@ VideoSchema.pre('save', function (next) {
|
|||
}
|
||||
)
|
||||
|
||||
async.parallel(tasks, function (err, results) {
|
||||
parallel(tasks, function (err, results) {
|
||||
if (err) return next(err)
|
||||
|
||||
video.magnetUri = results[0].magnetURI
|
||||
|
@ -234,7 +235,7 @@ function seedAllExisting (callback) {
|
|||
listOwned.call(this, function (err, videos) {
|
||||
if (err) return callback(err)
|
||||
|
||||
async.each(videos, function (video, callbackEach) {
|
||||
each(videos, function (video, callbackEach) {
|
||||
const videoPath = pathUtils.join(uploadsDir, video.filename)
|
||||
seed(videoPath, callbackEach)
|
||||
}, callback)
|
||||
|
@ -246,7 +247,7 @@ function seedAllExisting (callback) {
|
|||
function findWithCount (query, start, count, sort, callback) {
|
||||
const self = this
|
||||
|
||||
async.parallel([
|
||||
parallel([
|
||||
function (asyncCallback) {
|
||||
self.find(query).skip(start).limit(count).sort(sort).exec(asyncCallback)
|
||||
},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const chai = require('chai')
|
||||
const expect = chai.expect
|
||||
const pathUtils = require('path')
|
||||
const request = require('supertest')
|
||||
const series = require('async/series')
|
||||
|
||||
const utils = require('./utils')
|
||||
|
||||
|
@ -57,7 +57,7 @@ describe('Test parameters validator', function () {
|
|||
before(function (done) {
|
||||
this.timeout(20000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
utils.flushTests(next)
|
||||
},
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const chai = require('chai')
|
||||
const each = require('async/each')
|
||||
const expect = chai.expect
|
||||
const series = require('async/series')
|
||||
|
||||
const utils = require('./utils')
|
||||
|
||||
|
@ -45,7 +46,7 @@ describe('Test advanced friends', function () {
|
|||
utils.flushAndRunMultipleServers(6, function (serversRun, urlsRun) {
|
||||
servers = serversRun
|
||||
|
||||
async.each(servers, function (server, callbackEach) {
|
||||
each(servers, function (server, callbackEach) {
|
||||
utils.loginAndGetAccessToken(server, function (err, accessToken) {
|
||||
if (err) return callbackEach(err)
|
||||
|
||||
|
@ -59,7 +60,7 @@ describe('Test advanced friends', function () {
|
|||
it('Should make friends with two pod each in a different group', function (done) {
|
||||
this.timeout(20000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
// Pod 3 makes friend with the first one
|
||||
function (next) {
|
||||
makeFriends(3, next)
|
||||
|
@ -93,7 +94,7 @@ describe('Test advanced friends', function () {
|
|||
it('Should quit all friends', function (done) {
|
||||
this.timeout(10000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
quitFriends(1, next)
|
||||
},
|
||||
|
@ -103,7 +104,7 @@ describe('Test advanced friends', function () {
|
|||
function (err) {
|
||||
if (err) throw err
|
||||
|
||||
async.each([ 1, 2, 3, 4, 5, 6 ], function (i, callback) {
|
||||
each([ 1, 2, 3, 4, 5, 6 ], function (i, callback) {
|
||||
getFriendsList(i, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
@ -119,7 +120,7 @@ describe('Test advanced friends', function () {
|
|||
it('Should make friends with the pods 1, 2, 3', function (done) {
|
||||
this.timeout(150000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
// Pods 1, 2, 3 and 4 become friends
|
||||
function (next) {
|
||||
makeFriends(2, next)
|
||||
|
@ -132,7 +133,7 @@ describe('Test advanced friends', function () {
|
|||
},
|
||||
// Check the pods 1, 2, 3 and 4 are friends
|
||||
function (next) {
|
||||
async.each([ 1, 2, 3, 4 ], function (i, callback) {
|
||||
each([ 1, 2, 3, 4 ], function (i, callback) {
|
||||
getFriendsList(i, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
@ -211,7 +212,7 @@ describe('Test advanced friends', function () {
|
|||
it('Should pod 1 quit friends', function (done) {
|
||||
this.timeout(25000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
// Upload a video on server 3 for aditionnal tests
|
||||
function (next) {
|
||||
uploadVideo(3, next)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const chai = require('chai')
|
||||
const each = require('async/each')
|
||||
const expect = chai.expect
|
||||
const series = require('async/series')
|
||||
|
||||
const utils = require('./utils')
|
||||
|
||||
|
@ -45,7 +46,7 @@ describe('Test basic friends', function () {
|
|||
utils.flushAndRunMultipleServers(3, function (serversRun, urlsRun) {
|
||||
servers = serversRun
|
||||
|
||||
async.each(servers, function (server, callbackEach) {
|
||||
each(servers, function (server, callbackEach) {
|
||||
utils.loginAndGetAccessToken(server, function (err, accessToken) {
|
||||
if (err) return callbackEach(err)
|
||||
|
||||
|
@ -57,7 +58,7 @@ describe('Test basic friends', function () {
|
|||
})
|
||||
|
||||
it('Should not have friends', function (done) {
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
utils.getFriendsList(server.url, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
@ -72,7 +73,7 @@ describe('Test basic friends', function () {
|
|||
it('Should make friends', function (done) {
|
||||
this.timeout(10000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
// The second pod make friend with the third
|
||||
function (next) {
|
||||
makeFriends(2, next)
|
||||
|
@ -119,7 +120,7 @@ describe('Test basic friends', function () {
|
|||
// Now each pod should be friend with the other ones
|
||||
function (err) {
|
||||
if (err) throw err
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
testMadeFriends(servers, server, callback)
|
||||
}, done)
|
||||
})
|
||||
|
@ -131,7 +132,7 @@ describe('Test basic friends', function () {
|
|||
})
|
||||
|
||||
it('Should quit friends of pod 2', function (done) {
|
||||
async.series([
|
||||
series([
|
||||
// Pod 1 quit friends
|
||||
function (next) {
|
||||
const server = servers[1]
|
||||
|
@ -151,7 +152,7 @@ describe('Test basic friends', function () {
|
|||
},
|
||||
// Other pods shouldn't have pod 1 too
|
||||
function (next) {
|
||||
async.each([ servers[0].url, servers[2].url ], function (url, callback) {
|
||||
each([ servers[0].url, servers[2].url ], function (url, callback) {
|
||||
utils.getFriendsList(url, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
@ -169,7 +170,7 @@ describe('Test basic friends', function () {
|
|||
it('Should allow pod 2 to make friend again', function (done) {
|
||||
const server = servers[1]
|
||||
utils.makeFriends(server.url, server.accessToken, function () {
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
testMadeFriends(servers, server, callback)
|
||||
}, done)
|
||||
})
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const chai = require('chai')
|
||||
const each = require('async/each')
|
||||
const expect = chai.expect
|
||||
const pathUtils = require('path')
|
||||
const series = require('async/series')
|
||||
|
||||
const utils = require('./utils')
|
||||
const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
|
||||
|
@ -16,7 +17,7 @@ describe('Test multiple pods', function () {
|
|||
before(function (done) {
|
||||
this.timeout(30000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
// Run servers
|
||||
function (next) {
|
||||
utils.flushAndRunMultipleServers(3, function (serversRun) {
|
||||
|
@ -26,7 +27,7 @@ describe('Test multiple pods', function () {
|
|||
},
|
||||
// Get the access tokens
|
||||
function (next) {
|
||||
async.each(servers, function (server, callbackEach) {
|
||||
each(servers, function (server, callbackEach) {
|
||||
utils.loginAndGetAccessToken(server, function (err, accessToken) {
|
||||
if (err) return callbackEach(err)
|
||||
|
||||
|
@ -56,7 +57,7 @@ describe('Test multiple pods', function () {
|
|||
})
|
||||
|
||||
it('Should not have videos for all pods', function (done) {
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
utils.getVideosList(server.url, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
@ -73,7 +74,7 @@ describe('Test multiple pods', function () {
|
|||
it('Should upload the video on pod 1 and propagate on each pod', function (done) {
|
||||
this.timeout(15000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
const name = 'my super name for pod 1'
|
||||
const description = 'my super description for pod 1'
|
||||
|
@ -88,7 +89,7 @@ describe('Test multiple pods', function () {
|
|||
function (err) {
|
||||
if (err) throw err
|
||||
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
let baseMagnet = null
|
||||
|
||||
utils.getVideosList(server.url, function (err, res) {
|
||||
|
@ -135,7 +136,7 @@ describe('Test multiple pods', function () {
|
|||
it('Should upload the video on pod 2 and propagate on each pod', function (done) {
|
||||
this.timeout(15000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
const name = 'my super name for pod 2'
|
||||
const description = 'my super description for pod 2'
|
||||
|
@ -150,7 +151,7 @@ describe('Test multiple pods', function () {
|
|||
function (err) {
|
||||
if (err) throw err
|
||||
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
let baseMagnet = null
|
||||
|
||||
utils.getVideosList(server.url, function (err, res) {
|
||||
|
@ -197,7 +198,7 @@ describe('Test multiple pods', function () {
|
|||
it('Should upload two videos on pod 3 and propagate on each pod', function (done) {
|
||||
this.timeout(30000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
const name = 'my super name for pod 3'
|
||||
const description = 'my super description for pod 3'
|
||||
|
@ -220,7 +221,7 @@ describe('Test multiple pods', function () {
|
|||
|
||||
let baseMagnet = null
|
||||
// All pods should have this video
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
utils.getVideosList(server.url, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
@ -372,7 +373,7 @@ describe('Test multiple pods', function () {
|
|||
it('Should remove the file 3 and 3-2 by asking pod 3', function (done) {
|
||||
this.timeout(15000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
utils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[0], next)
|
||||
},
|
||||
|
@ -387,7 +388,7 @@ describe('Test multiple pods', function () {
|
|||
})
|
||||
|
||||
it('Should have videos 1 and 3 on each pod', function (done) {
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
utils.getVideosList(server.url, function (err, res) {
|
||||
if (err) throw err
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const chai = require('chai')
|
||||
const each = require('async/each')
|
||||
const expect = chai.expect
|
||||
const fs = require('fs')
|
||||
const keyBy = require('lodash/keyBy')
|
||||
const pathUtils = require('path')
|
||||
const series = require('async/series')
|
||||
|
||||
const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
|
||||
webtorrent.silent = true
|
||||
|
@ -20,7 +21,7 @@ describe('Test a single pod', function () {
|
|||
before(function (done) {
|
||||
this.timeout(20000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
utils.flushTests(next)
|
||||
},
|
||||
|
@ -280,7 +281,7 @@ describe('Test a single pod', function () {
|
|||
'video_short.mp4', 'video_short.ogv', 'video_short.webm',
|
||||
'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
|
||||
]
|
||||
async.each(videos, function (video, callbackEach) {
|
||||
each(videos, function (video, callbackEach) {
|
||||
const name = video + ' name'
|
||||
const description = video + ' description'
|
||||
const tags = [ 'tag1', 'tag2', 'tag3' ]
|
||||
|
@ -318,7 +319,7 @@ describe('Test a single pod', function () {
|
|||
// For the next test
|
||||
videosListBase = videos
|
||||
|
||||
async.each(videos, function (video, callbackEach) {
|
||||
each(videos, function (video, callbackEach) {
|
||||
if (err) throw err
|
||||
const videoName = video.name.replace(' name', '')
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const chai = require('chai')
|
||||
const expect = chai.expect
|
||||
const pathUtils = require('path')
|
||||
const series = require('async/series')
|
||||
|
||||
const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
|
||||
webtorrent.silent = true
|
||||
|
@ -18,7 +18,7 @@ describe('Test users', function () {
|
|||
before(function (done) {
|
||||
this.timeout(20000)
|
||||
|
||||
async.series([
|
||||
series([
|
||||
function (next) {
|
||||
utils.flushTests(next)
|
||||
},
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
const async = require('async')
|
||||
const program = require('commander')
|
||||
const each = require('each')
|
||||
const isEqual = require('lodash/isEqual')
|
||||
const program = require('commander')
|
||||
const series = require('async/series')
|
||||
|
||||
process.env.NODE_ENV = 'test'
|
||||
const constants = require('../../initializers/constants')
|
||||
|
@ -93,7 +94,7 @@ function getRandomNumServer (servers) {
|
|||
function runServers (numberOfPods, callback) {
|
||||
let servers = null
|
||||
|
||||
async.series([
|
||||
series([
|
||||
// Run servers
|
||||
function (next) {
|
||||
utils.flushAndRunMultipleServers(numberOfPods, function (serversRun) {
|
||||
|
@ -103,7 +104,7 @@ function runServers (numberOfPods, callback) {
|
|||
},
|
||||
// Get the access tokens
|
||||
function (next) {
|
||||
async.each(servers, function (server, callbackEach) {
|
||||
each(servers, function (server, callbackEach) {
|
||||
utils.loginAndGetAccessToken(server, function (err, accessToken) {
|
||||
if (err) return callbackEach(err)
|
||||
|
||||
|
@ -184,7 +185,7 @@ function remove (servers, numServer, callback) {
|
|||
|
||||
function checkIntegrity (servers, callback) {
|
||||
const videos = []
|
||||
async.each(servers, function (server, callback) {
|
||||
each(servers, function (server, callback) {
|
||||
utils.getAllVideosListBy(server.url, function (err, res) {
|
||||
if (err) throw err
|
||||
const serverVideos = res.body.data
|
||||
|
|
Loading…
Reference in New Issue