Fix 410 Gone race on account deletes (#1507)

This commit is contained in:
Sam Lade 2023-02-15 19:41:16 +00:00 committed by GitHub
parent b8e1ab312d
commit 40b584c219
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -209,6 +209,16 @@ func (f *federator) AuthenticatePostInbox(ctx context.Context, w http.ResponseWr
transport.WithFastfail(ctx), username, publicKeyOwnerURI, false, transport.WithFastfail(ctx), username, publicKeyOwnerURI, false,
) )
if err != nil { if err != nil {
if errors.Is(err, transport.ErrGone) {
// This is the same case as the http.StatusGone check above.
// It can happen here and not there because there's a race
// where the sending server starts sending account deletion
// notifications out, we start processing, the request above
// succeeds, and *then* the profile is removed and starts
// returning 410 Gone, at which point _this_ request fails.
w.WriteHeader(http.StatusAccepted)
return ctx, false, nil
}
return nil, false, fmt.Errorf("couldn't get requesting account %s: %s", publicKeyOwnerURI, err) return nil, false, fmt.Errorf("couldn't get requesting account %s: %s", publicKeyOwnerURI, err)
} }