From 1a42c9e2c0fb64cdbebd81b311736e752f591e0a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 18 Jul 2016 17:17:52 +0200 Subject: Server: udpate async to 2.0.0 --- server/controllers/api/v1/pods.js | 9 +++++---- server/controllers/api/v1/remote.js | 7 ++++--- server/controllers/api/v1/videos.js | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/v1/pods.js b/server/controllers/api/v1/pods.js index 4413fbc1e..2bc761fef 100644 --- a/server/controllers/api/v1/pods.js +++ b/server/controllers/api/v1/pods.js @@ -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) } diff --git a/server/controllers/api/v1/remote.js b/server/controllers/api/v1/remote.js index 9c2ca86e0..f452986b8 100644 --- a/server/controllers/api/v1/remote.js +++ b/server/controllers/api/v1/remote.js @@ -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) diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index a37e9278e..1f939b077 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js @@ -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) }, -- cgit v1.2.3