diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-05 21:36:01 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-05 21:36:01 +0200 |
commit | 6666aad4599a78f98f39409ec0d45391da7bd2d0 (patch) | |
tree | 2935754fb62522b085ffb41af2592b7a9a56e5ac /server/controllers/api/v1/remote.js | |
parent | 0890478c5c259bb787dc7f847e38be081df7c8e1 (diff) | |
download | PeerTube-6666aad4599a78f98f39409ec0d45391da7bd2d0.tar.gz PeerTube-6666aad4599a78f98f39409ec0d45391da7bd2d0.tar.zst PeerTube-6666aad4599a78f98f39409ec0d45391da7bd2d0.zip |
Fix requests ordering between pods
Diffstat (limited to 'server/controllers/api/v1/remote.js')
-rw-r--r-- | server/controllers/api/v1/remote.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/controllers/api/v1/remote.js b/server/controllers/api/v1/remote.js index 7af9b7e84..9c2ca86e0 100644 --- a/server/controllers/api/v1/remote.js +++ b/server/controllers/api/v1/remote.js | |||
@@ -39,6 +39,8 @@ function remoteVideos (req, res, next) { | |||
39 | addRemoteVideo(videoData, callbackEach) | 39 | addRemoteVideo(videoData, callbackEach) |
40 | } else if (request.type === 'remove') { | 40 | } else if (request.type === 'remove') { |
41 | removeRemoteVideo(videoData, fromUrl, callbackEach) | 41 | removeRemoteVideo(videoData, fromUrl, callbackEach) |
42 | } else { | ||
43 | logger.error('Unkown remote request type %s.', request.type) | ||
42 | } | 44 | } |
43 | }, function (err) { | 45 | }, function (err) { |
44 | if (err) logger.error('Error managing remote videos.', { error: err }) | 46 | if (err) logger.error('Error managing remote videos.', { error: err }) |
@@ -49,6 +51,8 @@ function remoteVideos (req, res, next) { | |||
49 | } | 51 | } |
50 | 52 | ||
51 | function addRemoteVideo (videoToCreateData, callback) { | 53 | function addRemoteVideo (videoToCreateData, callback) { |
54 | logger.debug('Adding remote video %s.', videoToCreateData.magnetUri) | ||
55 | |||
52 | // Mongoose pre hook will automatically create the thumbnail on disk | 56 | // Mongoose pre hook will automatically create the thumbnail on disk |
53 | videoToCreateData.thumbnail = videoToCreateData.thumbnailBase64 | 57 | videoToCreateData.thumbnail = videoToCreateData.thumbnailBase64 |
54 | 58 | ||
@@ -64,7 +68,13 @@ function removeRemoteVideo (videoToRemoveData, fromUrl, callback) { | |||
64 | return callback(err) | 68 | return callback(err) |
65 | } | 69 | } |
66 | 70 | ||
71 | if (videosList.length === 0) { | ||
72 | logger.error('No remote video was found for this pod.', { magnetUri: videoToRemoveData.magnetUri, podUrl: fromUrl }) | ||
73 | } | ||
74 | |||
67 | async.each(videosList, function (video, callbackEach) { | 75 | async.each(videosList, function (video, callbackEach) { |
76 | logger.debug('Removing remote video %s.', video.magnetUri) | ||
77 | |||
68 | video.remove(callbackEach) | 78 | video.remove(callbackEach) |
69 | }, callback) | 79 | }, callback) |
70 | }) | 80 | }) |