diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-06-30 20:01:01 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-09 19:40:12 +0200 |
| commit | fd3bba535d0200374dad3bd872650a4ceb075cf2 (patch) | |
| tree | b9151e2694710b65cb0e209b192b7fb9d9d1abc3 /dashboard/app/handler.go | |
| parent | a1aebcca7f3ce0215d6ef3981014d04707c50a60 (diff) | |
dashboard/app: cache per-namespace bug stats
We used to show number of fixed bugs at the top of the main page.
However, now with the button nagivation, "fixed" is shown on every page.
Fetching and processing all bugs on every page would be unwise.
Cache these stats in memcache. It will be useful to show more stats in future.
Diffstat (limited to 'dashboard/app/handler.go')
| -rw-r--r-- | dashboard/app/handler.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dashboard/app/handler.go b/dashboard/app/handler.go index ed55831d8..2daa203d1 100644 --- a/dashboard/app/handler.go +++ b/dashboard/app/handler.go @@ -97,6 +97,7 @@ type uiHeader struct { AnalyticsTrackingID string Subpage string Namespace string + Cached *Cached Namespaces []uiNamespace } @@ -171,6 +172,11 @@ func commonHeader(c context.Context, r *http.Request, w http.ResponseWriter, ns h.Namespace = ns cookie.Namespace = ns encodeCookie(w, cookie) + cached, err := CacheGet(c, r, ns) + if err != nil { + return nil, err + } + h.Cached = cached } return h, nil } |
