Skip to content

Commit

Permalink
Cache ctx.User in retrieveFeeds (#1902)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethantkoenig authored and lunny committed Jun 8, 2017
1 parent ff74241 commit 9ddc35e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions routers/user/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ func retrieveFeeds(ctx *context.Context, user *models.User, includePrivate, isPr
}

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

0 comments on commit 9ddc35e

Please sign in to comment.