const activityObject = activity.object
const actor = await getOrCreateActorAndServerAndModel(activity.actor)
- return processFollow(actor, activityObject)
+ return retryTransactionWrapper(processFollow, actor, activityObject)
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
-function processFollow (actor: ActorModel, targetActorURL: string) {
- const options = {
- arguments: [ actor, targetActorURL ],
- errorMessage: 'Cannot follow with many retries.'
- }
-
- return retryTransactionWrapper(follow, options)
-}
-
-async function follow (actor: ActorModel, targetActorURL: string) {
+async function processFollow (actor: ActorModel, targetActorURL: string) {
await sequelizeTypescript.transaction(async t => {
const targetActor = await ActorModel.loadByUrl(targetActorURL, t)
actorFollow.ActorFollowing = targetActor
// Target sends to actor he accepted the follow request
- return sendAccept(actorFollow, t)
+ return sendAccept(actorFollow)
})
logger.info('Actor %s is followed by actor %s.', targetActorURL, actor.url)