diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2023-10-30 15:13:43 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-10-31 10:09:36 +0000 |
| commit | 0badc11cea5bbdc5d2365f38925133398d1895a9 (patch) | |
| tree | db479a6f80788c5d98c6c376b906d7da938e4798 /dashboard/app/main.go | |
| parent | c77f120ffab696387579893f12de6f3081526fed (diff) | |
dashboard: cache managers lists on the main page
This is a relatively expensive operation (hundreds of ms) that queries
many types of entities. At the same time, the content does not change
that often.
Cache it for 5 minutes after querying.
Diffstat (limited to 'dashboard/app/main.go')
| -rw-r--r-- | dashboard/app/main.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 4b525b694..7af3404f0 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -22,6 +22,7 @@ import ( "github.com/google/syzkaller/dashboard/dashapi" "github.com/google/syzkaller/pkg/debugtracer" "github.com/google/syzkaller/pkg/email" + "github.com/google/syzkaller/pkg/hash" "github.com/google/syzkaller/pkg/html" "github.com/google/syzkaller/pkg/subsystem" "github.com/google/syzkaller/pkg/vcs" @@ -469,6 +470,10 @@ func (filter *userBugFilter) MatchBug(bug *Bug) bool { return true } +func (filter *userBugFilter) Hash() string { + return hash.String([]byte(fmt.Sprintf("%#v", filter))) +} + func splitLabel(rawLabel string) (BugLabelType, string) { label, value, _ := strings.Cut(rawLabel, ":") return BugLabelType(label), value @@ -492,7 +497,7 @@ func handleMain(c context.Context, w http.ResponseWriter, r *http.Request) error if err != nil { return fmt.Errorf("%w: failed to parse URL parameters", ErrClientBadRequest) } - managers, err := loadManagers(c, accessLevel, hdr.Namespace, filter) + managers, err := CachedUIManagers(c, accessLevel, hdr.Namespace, filter) if err != nil { return err } |
