[chore] Refactor federatingDB.Undo, avoid 500 errors on Undo Like #3310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request does a bit of refactoring of
undo.go
in the federatingdb package, specifically to bring it in line with other more modern files in that package likereject.go
.Thing 1: Don't return 500 if we just can't get something because we never had it stored. This was happening frequently when Misskey and Friendica instances were sending us Undo's of Likes that we'd never processed, leading to annoying log messages like this:
Now we just ignore such messages + return 202.
Thing 2: Have the federatingactor actually check for possible
gtserror.WithCode
instances, and use those instead of falling back to 500. I think we just forgot to hook this up, so we were returning lots of fancy different types ofWithCode
errors, but just squashing them all into 500 anyway :') Oops.No real logic changes aside from that!
Checklist
Please put an x inside each checkbox to indicate that you've read and followed it:
[ ]
->[x]
If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).
go fmt ./...
andgolangci-lint run
.