mirror of https://github.com/Chocobozzz/PeerTube
Server: do not break remote videos processing on error
parent
dea32aacde
commit
d8cc063e97
|
@ -73,10 +73,10 @@ function addRemoteVideoRetryWrapper (videoToCreateData, fromPod, finalCallback)
|
||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error('Cannot insert the remote video with many retries.', { error: err })
|
logger.error('Cannot insert the remote video with many retries.', { error: err })
|
||||||
return finalCallback(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalCallback()
|
// Do not return the error, continue the process
|
||||||
|
return finalCallback(null)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ function addRemoteVideo (videoToCreateData, fromPod, finalCallback) {
|
||||||
t.commit().asCallback(function (err) {
|
t.commit().asCallback(function (err) {
|
||||||
if (err) return finalCallback(err)
|
if (err) return finalCallback(err)
|
||||||
|
|
||||||
logger.info('Remote video %s inserted.', videoToCreateData.videoToCreateData.name)
|
logger.info('Remote video %s inserted.', videoToCreateData.name)
|
||||||
return finalCallback(null)
|
return finalCallback(null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -189,10 +189,10 @@ function updateRemoteVideoRetryWrapper (videoAttributesToUpdate, fromPod, finalC
|
||||||
function (err) {
|
function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.error('Cannot update the remote video with many retries.', { error: err })
|
logger.error('Cannot update the remote video with many retries.', { error: err })
|
||||||
return finalCallback(err)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return finalCallback()
|
// Do not return the error, continue the process
|
||||||
|
return finalCallback(null)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -270,10 +270,18 @@ function updateRemoteVideo (videoAttributesToUpdate, fromPod, finalCallback) {
|
||||||
function removeRemoteVideo (videoToRemoveData, fromPod, callback) {
|
function removeRemoteVideo (videoToRemoveData, fromPod, callback) {
|
||||||
// We need the instance because we have to remove some other stuffs (thumbnail etc)
|
// We need the instance because we have to remove some other stuffs (thumbnail etc)
|
||||||
fetchVideo(fromPod.host, videoToRemoveData.remoteId, function (err, video) {
|
fetchVideo(fromPod.host, videoToRemoveData.remoteId, function (err, video) {
|
||||||
if (err) return callback(err)
|
// Do not return the error, continue the process
|
||||||
|
if (err) return callback(null)
|
||||||
|
|
||||||
logger.debug('Removing remote video %s.', video.remoteId)
|
logger.debug('Removing remote video %s.', video.remoteId)
|
||||||
video.destroy().asCallback(callback)
|
video.destroy().asCallback(function (err) {
|
||||||
|
// Do not return the error, continue the process
|
||||||
|
if (err) {
|
||||||
|
logger.error('Cannot remove remote video with id %s.', videoToRemoveData.remoteId, { error: err })
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback(null)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +291,8 @@ function reportAbuseRemoteVideo (reportData, fromPod, callback) {
|
||||||
if (!err) err = new Error('video not found')
|
if (!err) err = new Error('video not found')
|
||||||
|
|
||||||
logger.error('Cannot load video from id.', { error: err, id: reportData.videoRemoteId })
|
logger.error('Cannot load video from id.', { error: err, id: reportData.videoRemoteId })
|
||||||
return callback(err)
|
// Do not return the error, continue the process
|
||||||
|
return callback(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug('Reporting remote abuse for video %s.', video.id)
|
logger.debug('Reporting remote abuse for video %s.', video.id)
|
||||||
|
@ -295,7 +304,13 @@ function reportAbuseRemoteVideo (reportData, fromPod, callback) {
|
||||||
videoId: video.id
|
videoId: video.id
|
||||||
}
|
}
|
||||||
|
|
||||||
db.VideoAbuse.create(videoAbuseData).asCallback(callback)
|
db.VideoAbuse.create(videoAbuseData).asCallback(function (err) {
|
||||||
|
if (err) {
|
||||||
|
logger.error('Cannot create remote abuse video.', { error: err })
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback(null)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,6 @@ function makeRequests () {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info('Making requests to friends.')
|
|
||||||
|
|
||||||
// We want to group requests by destinations pod and endpoint
|
// We want to group requests by destinations pod and endpoint
|
||||||
const requestsToMakeGrouped = {}
|
const requestsToMakeGrouped = {}
|
||||||
Object.keys(requests).forEach(function (toPodId) {
|
Object.keys(requests).forEach(function (toPodId) {
|
||||||
|
@ -176,6 +174,8 @@ function makeRequests () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
logger.info('Making requests to friends.', { requests: requestsToMakeGrouped })
|
||||||
|
|
||||||
const goodPods = []
|
const goodPods = []
|
||||||
const badPods = []
|
const badPods = []
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ const numberOfPods = 6
|
||||||
// Wait requests between pods
|
// Wait requests between pods
|
||||||
const baseRequestInterval = integrityInterval < constants.REQUESTS_INTERVAL ? integrityInterval : constants.REQUESTS_INTERVAL
|
const baseRequestInterval = integrityInterval < constants.REQUESTS_INTERVAL ? integrityInterval : constants.REQUESTS_INTERVAL
|
||||||
const requestsMaxPerInterval = baseRequestInterval / actionInterval
|
const requestsMaxPerInterval = baseRequestInterval / actionInterval
|
||||||
const intervalsToMakeAllRequests = Math.ceil(requestsMaxPerInterval / constants.REQUESTS_LIMIT)
|
const intervalsToMakeAllRequests = Math.ceil(requestsMaxPerInterval / (constants.REQUESTS_LIMIT_PER_POD * numberOfPods))
|
||||||
const waitForBeforeIntegrityCheck = (intervalsToMakeAllRequests * constants.REQUESTS_INTERVAL) + 1000
|
const waitForBeforeIntegrityCheck = (intervalsToMakeAllRequests * constants.REQUESTS_INTERVAL) + 1000
|
||||||
|
|
||||||
console.log('Create weight: %d, remove weight: %d.', createWeight, removeWeight)
|
console.log('Create weight: %d, remove weight: %d.', createWeight, removeWeight)
|
||||||
|
|
Loading…
Reference in New Issue