From 60650c77c8a2a98e92d869b237ae4900f369a8fc Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Jan 2018 09:35:50 +0100 Subject: Add scores to follows and remove bad ones --- .../activitypub-http-unicast-handler.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts') diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts index 175ec6642..e02bd698e 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-unicast-handler.ts @@ -1,5 +1,6 @@ import { logger } from '../../../helpers/logger' import { doRequest } from '../../../helpers/requests' +import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActivityPubHttpPayload, buildSignedRequestOptions, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler' async function process (payload: ActivityPubHttpPayload, jobId: number) { @@ -18,8 +19,13 @@ async function process (payload: ActivityPubHttpPayload, jobId: number) { try { await doRequest(options) + await ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([ uri ], [], undefined) } catch (err) { - await maybeRetryRequestLater(err, payload, uri) + const isRetryingLater = await maybeRetryRequestLater(err, payload, uri) + if (isRetryingLater === false) { + await ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes([], [ uri ], undefined) + } + throw err } } -- cgit v1.2.3