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

[chore] Tidy up some of the search logic #1082

Merged
merged 21 commits into from
Nov 29, 2022
Merged

[chore] Tidy up some of the search logic #1082

merged 21 commits into from
Nov 29, 2022

Conversation

tsmethurst
Copy link
Contributor

@tsmethurst tsmethurst commented Nov 19, 2022

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 (see internal/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.

@NyaaaWhatsUpDoc
Copy link
Member

@tsmethurst let me know once this is passing tests / ready and i'll take a look :)

@tsmethurst

This comment was marked as outdated.

@tsmethurst tsmethurst marked this pull request as draft November 22, 2022 18:00
@tsmethurst tsmethurst marked this pull request as ready for review November 24, 2022 10:26
@tsmethurst
Copy link
Contributor Author

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants