- const sanitizedHost = sanitizeHost(host, REMOTE_SCHEME.HTTP)
-
- // We process each host in a specific transaction
- // First, we add the follow request in the database
- // Then we send the follow request to other actor
- const p = loadActorUrlOrGetFromWebfinger(actorName, sanitizedHost)
- .then(actorUrl => getOrCreateActorAndServerAndModel(actorUrl))
- .then(targetActor => {
- const options = {
- arguments: [ fromActor, targetActor ],
- errorMessage: 'Cannot follow with many retries.'
- }
-
- return retryTransactionWrapper(follow, options)
- })
- .catch(err => logger.warn('Cannot follow server %s.', sanitizedHost, err))
-
- tasks.push(p)
+ const payload = {
+ host,
+ name: SERVER_ACTOR_NAME,
+ followerActorId: follower.id
+ }
+
+ JobQueue.Instance.createJob({ type: 'activitypub-follow', payload })
+ .catch(err => logger.error('Cannot create follow job for %s.', host, err))