[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
parent 1e1cdee06a
commit 614ab12733
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))
}