X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=server%2Flib%2Factivitypub%2Fprocess%2Fprocess-update.ts;h=73db461c30c7962766d45d16ec79d8c3f87e6f19;hb=90d4bb8125e80c8060416d4d135ddeaf0a622ede;hp=1ebda46d33d784c076e6ba20d325f61c66987353;hpb=3cd0734fd9b0ff21aaef02317a874e8f1c06e027;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 1ebda46d3..73db461c3 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts @@ -25,9 +25,9 @@ async function processUpdateActivity (activity: ActivityUpdate) { const objectType = activity.object.type if (objectType === 'Video') { - return processUpdateVideo(actor, activity) + return retryTransactionWrapper(processUpdateVideo, actor, activity) } else if (objectType === 'Person' || objectType === 'Application' || objectType === 'Group') { - return processUpdateActor(actor, activity) + return retryTransactionWrapper(processUpdateActor, actor, activity) } return undefined @@ -41,16 +41,7 @@ export { // --------------------------------------------------------------------------- -function processUpdateVideo (actor: ActorModel, activity: ActivityUpdate) { - const options = { - arguments: [ actor, activity ], - errorMessage: 'Cannot update the remote video with many retries' - } - - return retryTransactionWrapper(updateRemoteVideo, options) -} - -async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { +async function processUpdateVideo (actor: ActorModel, activity: ActivityUpdate) { const videoObject = activity.object as VideoTorrentObject if (sanitizeAndCheckVideoTorrentObject(videoObject) === false) { @@ -136,16 +127,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { } } -function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) { - const options = { - arguments: [ actor, activity ], - errorMessage: 'Cannot update the remote actor with many retries' - } - - return retryTransactionWrapper(updateRemoteActor, options) -} - -async function updateRemoteActor (actor: ActorModel, activity: ActivityUpdate) { +async function processUpdateActor (actor: ActorModel, activity: ActivityUpdate) { const actorAttributesToUpdate = activity.object as ActivityPubActor logger.debug('Updating remote account "%s".', actorAttributesToUpdate.uuid)