Browse Source

Cache ctx.User in retrieveFeeds (#1902)

tags/v1.2.0-rc1
Ethan Koenig Lunny Xiao 8 years ago
parent
commit
0c449a3c32
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      routers/user/home.go

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

@@ -67,6 +67,9 @@ func retrieveFeeds(ctx *context.Context, user *models.User, includePrivate, isPr
} }


userCache := map[int64]*models.User{user.ID: user} userCache := map[int64]*models.User{user.ID: user}
if ctx.User != nil {
userCache[ctx.User.ID] = ctx.User
}
repoCache := map[int64]*models.Repository{} repoCache := map[int64]*models.Repository{}
for _, act := range actions { for _, act := range actions {
// Cache results to reduce queries. // Cache results to reduce queries.


Loading…
Cancel
Save