diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-01-22 18:41:20 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-01-27 08:57:27 +0000 |
| commit | 83bb17d041cb6e2e513510609ebf5ba8906feb6a (patch) | |
| tree | 0c1aa920cf9bb56619b0bce3abc88b59fad5f121 /syz-cluster/dashboard/handler.go | |
| parent | e6c1954040ddd50faa6a7a04c7055a2cd4ffdb46 (diff) | |
syz-cluster: use Request.Context()
Diffstat (limited to 'syz-cluster/dashboard/handler.go')
| -rw-r--r-- | syz-cluster/dashboard/handler.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/syz-cluster/dashboard/handler.go b/syz-cluster/dashboard/handler.go index 5e562ee11..e85a587c8 100644 --- a/syz-cluster/dashboard/handler.go +++ b/syz-cluster/dashboard/handler.go @@ -4,7 +4,6 @@ package main import ( - "context" "embed" "fmt" "html/template" @@ -56,7 +55,7 @@ func (h *dashboardHandler) seriesList(w http.ResponseWriter, r *http.Request) { } var data MainPageData var err error - data.List, err = h.seriesRepo.ListLatest(context.Background(), time.Time{}, 0) + data.List, err = h.seriesRepo.ListLatest(r.Context(), time.Time{}, 0) if err != nil { http.Error(w, fmt.Sprintf("failed to query the list: %v", err), http.StatusInternalServerError) return @@ -85,7 +84,7 @@ func (h *dashboardHandler) seriesInfo(w http.ResponseWriter, r *http.Request) { } var data SeriesData var err error - ctx := context.Background() + ctx := r.Context() data.Series, err = h.seriesRepo.GetByID(ctx, r.PathValue("id")) if err != nil { http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) @@ -142,8 +141,7 @@ func groupFindings(findings []*db.Finding) map[string][]*db.Finding { // nolint:dupl func (h *dashboardHandler) sessionLog(w http.ResponseWriter, r *http.Request) { - ctx := context.Background() - session, err := h.sessionRepo.GetByID(ctx, r.PathValue("id")) + session, err := h.sessionRepo.GetByID(r.Context(), r.PathValue("id")) if err != nil { http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) return @@ -157,8 +155,7 @@ func (h *dashboardHandler) sessionLog(w http.ResponseWriter, r *http.Request) { // nolint:dupl func (h *dashboardHandler) patchContent(w http.ResponseWriter, r *http.Request) { - ctx := context.Background() - patch, err := h.seriesRepo.PatchByID(ctx, r.PathValue("id")) + patch, err := h.seriesRepo.PatchByID(r.Context(), r.PathValue("id")) if err != nil { http.Error(w, fmt.Sprint(err), http.StatusInternalServerError) return |
