aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-11 18:06:51 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-11 18:06:51 +0100
commitd8cc063e9775688a1631eda9203411a2dba0333c (patch)
tree056b6e3ccf0cb5d97b2d300f0ed2776f24631d7a /server/controllers/api
parentdea32aacde362a5fbd62a88cd32487768b788468 (diff)
downloadPeerTube-d8cc063e9775688a1631eda9203411a2dba0333c.tar.gz
PeerTube-d8cc063e9775688a1631eda9203411a2dba0333c.tar.zst
PeerTube-d8cc063e9775688a1631eda9203411a2dba0333c.zip
Server: do not break remote videos processing on error
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/remote/videos.js33
1 files changed, 24 insertions, 9 deletions
diff --git a/server/controllers/api/remote/videos.js b/server/controllers/api/remote/videos.js
index 17bdce019..b9494f602 100644
--- a/server/controllers/api/remote/videos.js
+++ b/server/controllers/api/remote/videos.js
@@ -73,10 +73,10 @@ function addRemoteVideoRetryWrapper (videoToCreateData, fromPod, finalCallback)
73 function (err) { 73 function (err) {
74 if (err) { 74 if (err) {
75 logger.error('Cannot insert the remote video with many retries.', { error: err }) 75 logger.error('Cannot insert the remote video with many retries.', { error: err })
76 return finalCallback(err)
77 } 76 }
78 77
79 return finalCallback() 78 // Do not return the error, continue the process
79 return finalCallback(null)
80 } 80 }
81 ) 81 )
82} 82}
@@ -174,7 +174,7 @@ function addRemoteVideo (videoToCreateData, fromPod, finalCallback) {
174 t.commit().asCallback(function (err) { 174 t.commit().asCallback(function (err) {
175 if (err) return finalCallback(err) 175 if (err) return finalCallback(err)
176 176
177 logger.info('Remote video %s inserted.', videoToCreateData.videoToCreateData.name) 177 logger.info('Remote video %s inserted.', videoToCreateData.name)
178 return finalCallback(null) 178 return finalCallback(null)
179 }) 179 })
180 }) 180 })
@@ -189,10 +189,10 @@ function updateRemoteVideoRetryWrapper (videoAttributesToUpdate, fromPod, finalC
189 function (err) { 189 function (err) {
190 if (err) { 190 if (err) {
191 logger.error('Cannot update the remote video with many retries.', { error: err }) 191 logger.error('Cannot update the remote video with many retries.', { error: err })
192 return finalCallback(err)
193 } 192 }
194 193
195 return finalCallback() 194 // Do not return the error, continue the process
195 return finalCallback(null)
196 } 196 }
197 ) 197 )
198} 198}
@@ -270,10 +270,18 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) {
270function removeRemoteVideo (videoToRemoveData, fromPod, callback) { 270function removeRemoteVideo (videoToRemoveData, fromPod, callback) {
271 // We need the instance because we have to remove some other stuffs (thumbnail etc) 271 // We need the instance because we have to remove some other stuffs (thumbnail etc)
272 fetchVideo(fromPod.host, videoToRemoveData.remoteId, function (err, video) { 272 fetchVideo(fromPod.host, videoToRemoveData.remoteId, function (err, video) {
273 if (err) return callback(err) 273 // Do not return the error, continue the process
274 if (err) return callback(null)
274 275
275 logger.debug('Removing remote video %s.', video.remoteId) 276 logger.debug('Removing remote video %s.', video.remoteId)
276 video.destroy().asCallback(callback) 277 video.destroy().asCallback(function (err) {
278 // Do not return the error, continue the process
279 if (err) {
280 logger.error('Cannot remove remote video with id %s.', videoToRemoveData.remoteId, { error: err })
281 }
282
283 return callback(null)
284 })
277 }) 285 })
278} 286}
279 287
@@ -283,7 +291,8 @@ function reportAbuseRemoteVideo (reportData, fromPod, callback) {
283 if (!err) err = new Error('video not found') 291 if (!err) err = new Error('video not found')
284 292
285 logger.error('Cannot load video from id.', { error: err, id: reportData.videoRemoteId }) 293 logger.error('Cannot load video from id.', { error: err, id: reportData.videoRemoteId })
286 return callback(err) 294 // Do not return the error, continue the process
295 return callback(null)
287 } 296 }
288 297
289 logger.debug('Reporting remote abuse for video %s.', video.id) 298 logger.debug('Reporting remote abuse for video %s.', video.id)
@@ -295,7 +304,13 @@ function reportAbuseRemoteVideo (reportData, fromPod, callback) {
295 videoId: video.id 304 videoId: video.id
296 } 305 }
297 306
298 db.VideoAbuse.create(videoAbuseData).asCallback(callback) 307 db.VideoAbuse.create(videoAbuseData).asCallback(function (err) {
308 if (err) {
309 logger.error('Cannot create remote abuse video.', { error: err })
310 }
311
312 return callback(null)
313 })
299 }) 314 })
300} 315}
301 316