From 56f53a2a6f85876485e2ae67d48b78b448caed6e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 3 Oct 2022 10:46:11 +0200 Subject: [performance] add user cache and database (#879) * go fmt * add + use user cache and database * fix import * update tests * remove unused relation --- internal/processing/instance.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/processing/instance.go') diff --git a/internal/processing/instance.go b/internal/processing/instance.go index b7418659a..32a4de6f0 100644 --- a/internal/processing/instance.go +++ b/internal/processing/instance.go @@ -142,8 +142,8 @@ func (p *processor) InstancePatch(ctx context.Context, form *apimodel.InstanceSe return nil, gtserror.NewErrorBadRequest(err, fmt.Sprintf("account with username %s not retrievable", *form.ContactUsername)) } // make sure it has a user associated with it - contactUser := >smodel.User{} - if err := p.db.GetWhere(ctx, []db.Where{{Key: "account_id", Value: contactAccount.ID}}, contactUser); err != nil { + contactUser, err := p.db.GetUserByAccountID(ctx, contactAccount.ID) + if err != nil { return nil, gtserror.NewErrorBadRequest(err, fmt.Sprintf("user for account with username %s not retrievable", *form.ContactUsername)) } // suspended accounts cannot be contact accounts -- cgit v1.2.3