Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(backend): 配送先が410 Goneで応答してきた場合配送停止するように #10298

Merged
merged 3 commits into from
Mar 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/backend/src/queue/processors/DeliverProcessorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ export class DeliverProcessorService {
if (res instanceof StatusError) {
// 4xx
if (res.isClientError) {
// 相手が閉鎖していることを明示しているため、配送停止する
if (res.statusCode === 410) {
this.federatedInstanceService.fetch(host).then(i => {
this.instancesRepository.update(i.id, {
isSuspended: true,
});
this.federatedInstanceService.updateCachePartial(host, {
isSuspended: true,
});
});
return `${host} is gone`;
}
Comment on lines +118 to +129
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sharedInboxに配送して410を返されるパターンの他に、削除済みユーザー個人のinboxに配送して410を返されるパターンがあって、後者の場合はホスト全体を配送停止してはいけない。

なので、配送先がsharedInboxなのかinboxなのかをキューに持たせといて、sharedInboxへの配送が410だった場合のみ停止しないといけない。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// HTTPステータスコード4xxはクライアントエラーであり、それはつまり
// 何回再送しても成功することはないということなのでエラーにはしないでおく
return `${res.statusCode} ${res.statusMessage}`;
Expand Down