aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/controllers/api/remote/videos.js33
-rw-r--r--server/models/request.js4
-rw-r--r--server/tests/real-world/real-world.js2
3 files changed, 27 insertions, 12 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
diff --git a/server/models/request.js b/server/models/request.js
index 26953e5f5..e048c288b 100644
--- a/server/models/request.js
+++ b/server/models/request.js
@@ -152,8 +152,6 @@ function makeRequests () {
152 return 152 return
153 } 153 }
154 154
155 logger.info('Making requests to friends.')
156
157 // We want to group requests by destinations pod and endpoint 155 // We want to group requests by destinations pod and endpoint
158 const requestsToMakeGrouped = {} 156 const requestsToMakeGrouped = {}
159 Object.keys(requests).forEach(function (toPodId) { 157 Object.keys(requests).forEach(function (toPodId) {
@@ -176,6 +174,8 @@ function makeRequests () {
176 }) 174 })
177 }) 175 })
178 176
177 logger.info('Making requests to friends.', { requests: requestsToMakeGrouped })
178
179 const goodPods = [] 179 const goodPods = []
180 const badPods = [] 180 const badPods = []
181 181
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js
index 751d3923f..9a63860ad 100644
--- a/server/tests/real-world/real-world.js
+++ b/server/tests/real-world/real-world.js
@@ -36,7 +36,7 @@ const numberOfPods = 6
36// Wait requests between pods 36// Wait requests between pods
37const baseRequestInterval = integrityInterval < constants.REQUESTS_INTERVAL ? integrityInterval : constants.REQUESTS_INTERVAL 37const baseRequestInterval = integrityInterval < constants.REQUESTS_INTERVAL ? integrityInterval : constants.REQUESTS_INTERVAL
38const requestsMaxPerInterval = baseRequestInterval / actionInterval 38const requestsMaxPerInterval = baseRequestInterval / actionInterval
39const intervalsToMakeAllRequests = Math.ceil(requestsMaxPerInterval / constants.REQUESTS_LIMIT) 39const intervalsToMakeAllRequests = Math.ceil(requestsMaxPerInterval / (constants.REQUESTS_LIMIT_PER_POD * numberOfPods))
40const waitForBeforeIntegrityCheck = (intervalsToMakeAllRequests * constants.REQUESTS_INTERVAL) + 1000 40const waitForBeforeIntegrityCheck = (intervalsToMakeAllRequests * constants.REQUESTS_INTERVAL) + 1000
41 41
42console.log('Create weight: %d, remove weight: %d.', createWeight, removeWeight) 42console.log('Create weight: %d, remove weight: %d.', createWeight, removeWeight)