Browse Source

Cache ctxUser in retrieveFeeds(..) (#826)

for-closed-social
Ethan Koenig 7 years ago
committed by Lunny Xiao
parent
commit
400b6fd61c
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      routers/user/home.go

+ 3
- 1
routers/user/home.go View File

@ -65,7 +65,9 @@ func retrieveFeeds(ctx *context.Context, ctxUser *models.User, userID, offset in
// Check access of private repositories. // Check access of private repositories.
feeds := make([]*models.Action, 0, len(actions)) feeds := make([]*models.Action, 0, len(actions))
unameAvatars := make(map[string]string)
unameAvatars := map[string]string{
ctxUser.Name: ctxUser.RelAvatarLink(),
}
for _, act := range actions { for _, act := range actions {
// Cache results to reduce queries. // Cache results to reduce queries.
_, ok := unameAvatars[act.ActUserName] _, ok := unameAvatars[act.ActUserName]

Loading…
Cancel
Save