[performance] don't use relations to select notification structs, use caches instead (#1072)

This commit is contained in:
tobi 2022-11-18 17:23:14 +01:00 committed by GitHub
commit d98a48b446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View file

@ -55,9 +55,6 @@ func (n *notificationDB) GetNotification(ctx context.Context, id string) (*gtsmo
q := n.conn.NewSelect().
Model(&notif).
Relation("OriginAccount").
Relation("TargetAccount").
Relation("Status").
Where("? = ?", bun.Ident("notification.id"), id)
if err := q.Scan(ctx); err != nil {
return nil, n.conn.ProcessError(err)

View file

@ -113,9 +113,6 @@ func (suite *NotificationTestSuite) TestGetNotificationsWithoutSpam() {
suite.NotNil(notifications)
for _, n := range notifications {
suite.Equal(testAccount.ID, n.TargetAccountID)
suite.NotNil(n.OriginAccount)
suite.NotNil(n.TargetAccount)
suite.NotNil(n.Status)
}
}