aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/jobs/activitypub-http-job-scheduler/activitypub-http-broadcast-handler.ts
diff options
context:
space:
mode:
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.ts10
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 @@
1import { logger } from '../../../helpers/logger' 1import { logger } from '../../../helpers/logger'
2import { doRequest } from '../../../helpers/requests' 2import { doRequest } from '../../../helpers/requests'
3import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
3import { ActivityPubHttpPayload, buildSignedRequestOptions, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler' 4import { ActivityPubHttpPayload, buildSignedRequestOptions, computeBody, maybeRetryRequestLater } from './activitypub-http-job-scheduler'
4 5
5async function process (payload: ActivityPubHttpPayload, jobId: number) { 6async 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
29function onError (err: Error, jobId: number) { 37function onError (err: Error, jobId: number) {