dispatch with context where missing (#40810)

This commit is contained in:
Will Browne 2021-10-27 14:57:06 +01:00 committed by GitHub
parent 53b283ee01
commit 67449b95e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -659,7 +659,7 @@ func (hs *HTTPServer) RestoreDashboardVersion(c *models.ReqContext, apiCmd dtos.
func GetDashboardTags(c *models.ReqContext) {
query := models.GetDashboardTagsQuery{OrgId: c.OrgId}
err := bus.Dispatch(&query)
err := bus.DispatchCtx(c.Req.Context(), &query)
if err != nil {
c.JsonApiErr(500, "Failed to get tags from database", err)
return

View File

@ -127,7 +127,7 @@ func (srv *CleanUpService) shouldCleanupTempFile(filemtime time.Time, now time.T
func (srv *CleanUpService) deleteExpiredSnapshots() {
cmd := models.DeleteExpiredSnapshotsCommand{}
if err := bus.Dispatch(&cmd); err != nil {
if err := bus.DispatchCtx(context.TODO(), &cmd); err != nil {
srv.log.Error("Failed to delete expired snapshots", "error", err.Error())
} else {
srv.log.Debug("Deleted expired snapshots", "rows affected", cmd.DeletedRows)

View File

@ -1,6 +1,7 @@
package search
import (
"context"
"sort"
"github.com/grafana/grafana/pkg/setting"
@ -83,7 +84,7 @@ func (s *SearchService) searchHandler(query *Query) error {
dashboardQuery.Sort = sortOpt
}
if err := bus.Dispatch(&dashboardQuery); err != nil {
if err := bus.DispatchCtx(context.TODO(), &dashboardQuery); err != nil {
return err
}
@ -119,7 +120,7 @@ func setStarredDashboards(userID int64, hits []*Hit) error {
UserId: userID,
}
if err := bus.Dispatch(&query); err != nil {
if err := bus.DispatchCtx(context.TODO(), &query); err != nil {
return err
}