mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-01 06:12:25 -05:00
[performance] add user cache and database (#879)
* go fmt * add + use user cache and database * fix import * update tests * remove unused relation
This commit is contained in:
parent
f7af7c061c
commit
56f53a2a6f
21 changed files with 490 additions and 70 deletions
|
|
@ -68,8 +68,8 @@ func (f *filter) StatusVisible(ctx context.Context, targetStatus *gtsmodel.Statu
|
|||
// if the target user doesn't exist (anymore) then the status also shouldn't be visible
|
||||
// note: we only do this for local users
|
||||
if targetAccount.Domain == "" {
|
||||
targetUser := >smodel.User{}
|
||||
if err := f.db.GetWhere(ctx, []db.Where{{Key: "account_id", Value: targetAccount.ID}}, targetUser); err != nil {
|
||||
targetUser, err := f.db.GetUserByAccountID(ctx, targetAccount.ID)
|
||||
if err != nil {
|
||||
l.Debug("target user could not be selected")
|
||||
if err == db.ErrNoEntries {
|
||||
return false, nil
|
||||
|
|
@ -98,8 +98,8 @@ func (f *filter) StatusVisible(ctx context.Context, targetStatus *gtsmodel.Statu
|
|||
// if the requesting user doesn't exist (anymore) then the status also shouldn't be visible
|
||||
// note: we only do this for local users
|
||||
if requestingAccount.Domain == "" {
|
||||
requestingUser := >smodel.User{}
|
||||
if err := f.db.GetWhere(ctx, []db.Where{{Key: "account_id", Value: requestingAccount.ID}}, requestingUser); err != nil {
|
||||
requestingUser, err := f.db.GetUserByAccountID(ctx, requestingAccount.ID)
|
||||
if err != nil {
|
||||
// if the requesting account is local but doesn't have a corresponding user in the db this is a problem
|
||||
l.Debug("requesting user could not be selected")
|
||||
if err == db.ErrNoEntries {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue