From fd3bba535d0200374dad3bd872650a4ceb075cf2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 30 Jun 2020 20:01:01 +0200 Subject: 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. --- dashboard/app/handler.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'dashboard/app/handler.go') 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 } -- cgit mrf-deployment