- function listVideosOfTheseBadPods (pods, callback) {
- if (pods.length === 0) return callback(null)
-
- const urls = map(pods, 'url')
- const ids = map(pods, '_id')
-
- Video.listByUrls(urls, function (err, videosList) {
- if (err) {
- logger.error('Cannot list videos urls.', { error: err, urls: urls })
- return callback(null, ids, [])
- }
-
- return callback(null, ids, videosList)
- })
- },
-
- function removeVideosOfTheseBadPods (podIds, videosList, callback) {
- // We don't have to remove pods, skip
- if (typeof podIds === 'function') return podIds(null)
-
- async.each(videosList, function (video, callbackEach) {
- video.remove(callbackEach)
+ function removeTheseBadPods (pods, callback) {
+ each(pods, function (pod, callbackEach) {
+ pod.destroy().asCallback(callbackEach)