diff options
| author | Hazelnoot <acomputerdog@gmail.com> | 2025-03-03 00:52:54 -0500 |
|---|---|---|
| committer | Hazelnoot <acomputerdog@gmail.com> | 2025-06-06 22:19:49 -0400 |
| commit | 41dfe7e329f2a07f7f6e96f9f83b7f1bde83d8b9 (patch) | |
| tree | 11ae99674c7210ea5b4c3cd71630d4ef97edfc58 | |
| parent | recognize FetchError as retryable (diff) | |
| download | sharkey-41dfe7e329f2a07f7f6e96f9f83b7f1bde83d8b9.tar.gz sharkey-41dfe7e329f2a07f7f6e96f9f83b7f1bde83d8b9.tar.bz2 sharkey-41dfe7e329f2a07f7f6e96f9f83b7f1bde83d8b9.zip | |
remove duplicate error checking blocks from ApInboxService.ts
| -rw-r--r-- | packages/backend/src/core/activitypub/ApInboxService.ts | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/packages/backend/src/core/activitypub/ApInboxService.ts b/packages/backend/src/core/activitypub/ApInboxService.ts index c06939eae2..0ffe0eea92 100644 --- a/packages/backend/src/core/activitypub/ApInboxService.ts +++ b/packages/backend/src/core/activitypub/ApInboxService.ts @@ -357,22 +357,10 @@ export class ApInboxService { } // Announce対象をresolve - let renote; - try { - // The target ID is verified by secureResolve, so we know it shares host authority with the actor who sent it. - // This means we can pass that ID to resolveNote and avoid an extra fetch, which will fail if the note is private. - renote = await this.apNoteService.resolveNote(target, { resolver, sentFrom: getApId(target) }); - if (renote == null) return 'announce target is null'; - } catch (err) { - // 対象が4xxならスキップ - if (err instanceof StatusError) { - if (!err.isRetryable) { - return `skip: ignored announce target ${target.id} - ${err.statusCode}`; - } - return `Error in announce target ${target.id} - ${err.statusCode}`; - } - throw err; - } + // The target ID is verified by secureResolve, so we know it shares host authority with the actor who sent it. + // This means we can pass that ID to resolveNote and avoid an extra fetch, which will fail if the note is private. + const renote = await this.apNoteService.resolveNote(target, { resolver, sentFrom: getApId(target) }); + if (renote == null) return 'announce target is null'; if (!await this.noteEntityService.isVisibleForMe(renote, actor.id)) { return 'skip: invalid actor for this activity'; @@ -548,12 +536,6 @@ export class ApInboxService { await this.apNoteService.createNote(note, actor, resolver, silent); return 'ok'; - } catch (err) { - if (err instanceof StatusError && !err.isRetryable) { - return `skip: ${err.statusCode}`; - } else { - throw err; - } } finally { unlock(); } |