-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
[chore] Tidy up some of the search logic #1082
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tsmethurst let me know once this is passing tests / ready and i'll take a look :) |
This comment was marked as outdated.
This comment was marked as outdated.
@NyaaaWhatsUpDoc this is ready to go :) |
…ification itself Signed-off-by: kim <grufwub@gmail.com>
Signed-off-by: kim <grufwub@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
GetRemoteAccount and GetRemoteStatus are now renamed in order to signal that you can pass a request for a local status/account into them, they'll just return the status/account early + not do any "remote" lookups. (I think in future instead of having these functions attached to a federator, we can have them attached to some kind of account/status 'store' which can explicitly return either local or remote things, as appropriate.)
Now that faux-remote lookups are properly guarded against in those functions, the processor search logic has been tidied up to just call those functions directly, rather than doing db calls first (and then pointlessly repeating them again in some cases).
Rather than allowing all errors coming from those functions to go ignored, this PR also introduces a new
dereferencing.Error
type and different versions thereof (seeinternal/federation/dereferencing/error.go
). These types can be checked on by callers so that they only log errors where appropriate. This is now implemented in the processor: errors aren't logged by searching when something is just not retrievable, but if there's a database or significant transport error, they will be logged and result in an internal server error to denote that something is definitely not right.Right now, this better error checking + returning is just implemented for the GetStatus and GetAccount functions, because I ran out of spoons. In future, we should also implement the error checking for dereferencing media and instances and whatnot.
This should help us debug #929 but it remains to be seen if it closes it.