Skip to content

Commit

Permalink
tech: replace context.TODO with background ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
bergquist committed Feb 24, 2017
1 parent e73b306 commit 03354bc
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/api/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
return ApiError(500, "Metric request error", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/alerting/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
evalContext := NewEvalContext(alertCtx, job.Rule)
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/alerting/test_notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func createTestEvalContext(cmd *NotificationTestCommand) *EvalContext {
State: m.AlertStateAlerting,
}

ctx := NewEvalContext(context.TODO(), testRule)
ctx := NewEvalContext(context.Background(), testRule)
if cmd.Settings.Get("uploadImage").MustBool(true) {
ctx.ImagePublicUrl = "http://grafana.org/assets/img/blog/mixed_styles.png"
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/alerting/test_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func handleAlertTestCommand(cmd *AlertTestCommand) error {
func testAlertRule(rule *Rule) *EvalContext {
handler := NewEvalHandler()

context := NewEvalContext(context.TODO(), rule)
context := NewEvalContext(context.Background(), rule)
context.IsTestRun = true

handler.Eval(context)
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/notifications/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func processWebhookQueue() {
for {
select {
case webhook := <-webhookQueue:
err := sendWebRequestSync(context.TODO(), webhook)
err := sendWebRequestSync(context.Background(), webhook)

if err != nil {
webhookLog.Error("Failed to send webrequest ", "error", err)
Expand Down

0 comments on commit 03354bc

Please sign in to comment.