mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech: replace context.TODO with background ctx
This commit is contained in:
parent
e73b306e0c
commit
03354bc49a
@ -33,7 +33,7 @@ func QueryMetrics(c *middleware.Context, reqDto dtos.MetricRequest) Response {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := tsdb.HandleRequest(context.TODO(), request)
|
resp, err := tsdb.HandleRequest(context.Background(), request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ApiError(500, "Metric request error", err)
|
return ApiError(500, "Metric request error", err)
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ func (e *Engine) processJob(grafanaCtx context.Context, job *Job) error {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
alertCtx, cancelFn := context.WithTimeout(context.TODO(), alertTimeout)
|
alertCtx, cancelFn := context.WithTimeout(context.Background(), alertTimeout)
|
||||||
|
|
||||||
job.Running = true
|
job.Running = true
|
||||||
evalContext := NewEvalContext(alertCtx, job.Rule)
|
evalContext := NewEvalContext(alertCtx, job.Rule)
|
||||||
|
@ -50,7 +50,7 @@ func createTestEvalContext(cmd *NotificationTestCommand) *EvalContext {
|
|||||||
State: m.AlertStateAlerting,
|
State: m.AlertStateAlerting,
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := NewEvalContext(context.TODO(), testRule)
|
ctx := NewEvalContext(context.Background(), testRule)
|
||||||
if cmd.Settings.Get("uploadImage").MustBool(true) {
|
if cmd.Settings.Get("uploadImage").MustBool(true) {
|
||||||
ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png"
|
ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png"
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ func handleAlertTestCommand(cmd *AlertTestCommand) error {
|
|||||||
func testAlertRule(rule *Rule) *EvalContext {
|
func testAlertRule(rule *Rule) *EvalContext {
|
||||||
handler := NewEvalHandler()
|
handler := NewEvalHandler()
|
||||||
|
|
||||||
context := NewEvalContext(context.TODO(), rule)
|
context := NewEvalContext(context.Background(), rule)
|
||||||
context.IsTestRun = true
|
context.IsTestRun = true
|
||||||
|
|
||||||
handler.Eval(context)
|
handler.Eval(context)
|
||||||
|
@ -37,7 +37,7 @@ func processWebhookQueue() {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case webhook := <-webhookQueue:
|
case webhook := <-webhookQueue:
|
||||||
err := sendWebRequestSync(context.TODO(), webhook)
|
err := sendWebRequestSync(context.Background(), webhook)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
webhookLog.Error("Failed to send webrequest ", "error", err)
|
webhookLog.Error("Failed to send webrequest ", "error", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user