diff options
Diffstat (limited to 'server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts')
-rw-r--r-- | server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts index c20a48a4e..3f780e319 100644 --- a/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts +++ b/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import { logger } from '../../../helpers/logger' | 1 | import { logger } from '../../../helpers/logger' |
2 | import { doRequest } from '../../../helpers/requests' | 2 | import { doRequest } from '../../../helpers/requests' |
3 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | ||
3 | import { ActivityPubHttpPayload, buildSignedRequestOptions, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler' | 4 | import { ActivityPubHttpPayload, buildSignedRequestOptions, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler' |
4 | 5 | ||
5 | async function process (payload: ActivityPubHttpPayload, jobId: number) { | 6 | async function process (payload: ActivityPubHttpPayload, jobId: number) { |
@@ -15,15 +16,22 @@ async function process (payload: ActivityPubHttpPayload, jobId: number) { | |||
15 | httpSignature: httpSignatureOptions | 16 | httpSignature: httpSignatureOptions |
16 | } | 17 | } |
17 | 18 | ||
19 | const badUrls: string[] = [] | ||
20 | const goodUrls: string[] = [] | ||
21 | |||
18 | for (const uri of payload.uris) { | 22 | for (const uri of payload.uris) { |
19 | options.uri = uri | 23 | options.uri = uri |
20 | 24 | ||
21 | try { | 25 | try { |
22 | await doRequest(options) | 26 | await doRequest(options) |
27 | goodUrls.push(uri) | ||
23 | } catch (err) { | 28 | } catch (err) { |
24 | await maybeRetryRequestLater(err, payload, uri) | 29 | const isRetryingLater = await maybeRetryRequestLater(err, payload, uri) |
30 | if (isRetryingLater === false) badUrls.push(uri) | ||
25 | } | 31 | } |
26 | } | 32 | } |
33 | |||
34 | return ActorFollowModel.updateActorFollowsScoreAndRemoveBadOnes(goodUrls, badUrls, undefined) | ||
27 | } | 35 | } |
28 | 36 | ||
29 | function onError (err: Error, jobId: number) { | 37 | function onError (err: Error, jobId: number) { |