[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

@ -137,7 +137,7 @@ func (p *processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe
// validate & update site contact account if it's set on the form
if form.ContactUsername != nil {
// make sure the account with the given username exists in the db
contactAccount, err := p.db.GetLocalAccountByUsername(ctx, *form.ContactUsername)
contactAccount, err := p.db.GetAccountByUsernameDomain(ctx, *form.ContactUsername, "")
if err != nil {
return nil, gtserror.NewErrorBadRequest(err, fmt.Sprintf("account with username %s not retrievable", *form.ContactUsername))
}