[performance] use GetAccountByUsernameDomain() for local account lookups to rely on cache (#793)

Signed-off-by: kim <grufwub@gmail.com>

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim 2022-09-02 10:56:33 +01:00 committed by GitHub
commit 614ab12733
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 29 additions and 42 deletions

View file

@ -193,7 +193,7 @@ func (p *processor) searchAccountByURI(ctx context.Context, authed *oauth.Auth,
func (p *processor) searchAccountByMention(ctx context.Context, authed *oauth.Auth, username string, domain string, resolve bool) (*gtsmodel.Account, error) {
// if it's a local account we can skip a whole bunch of stuff
if domain == config.GetHost() || domain == config.GetAccountDomain() || domain == "" {
maybeAcct, err := p.db.GetLocalAccountByUsername(ctx, username)
maybeAcct, err := p.db.GetAccountByUsernameDomain(ctx, username, "")
if err == nil || err == db.ErrNoEntries {
return maybeAcct, nil
}