mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
Server: udpate async to 2.0.0
This commit is contained in:
parent
d56ec0d412
commit
1a42c9e2c0
15 changed files with 85 additions and 72 deletions
|
@ -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)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue