Skip to content

Commit

Permalink
cmd/incusd/warnings: Update context
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Hipp <thomashipp@gmail.com>
  • Loading branch information
monstermunchkin committed Feb 29, 2024
1 parent 9b3d56b commit f6a0a38
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/incusd/warnings.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func warningsGet(d *Daemon, r *http.Request) response.Response {
projectName := request.QueryParam(r, "project")

var warnings []api.Warning
err = d.State().DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
err = d.State().DB.Cluster.Transaction(r.Context(), func(ctx context.Context, tx *db.ClusterTx) error {
filters := []cluster.WarningFilter{}
if projectName != "" {
filter := cluster.WarningFilter{Project: &projectName}
Expand Down Expand Up @@ -269,7 +269,7 @@ func warningGet(d *Daemon, r *http.Request) response.Response {
}

var resp api.Warning
err = d.State().DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
err = d.State().DB.Cluster.Transaction(r.Context(), func(ctx context.Context, tx *db.ClusterTx) error {
dbWarning, err := cluster.GetWarning(ctx, tx.Tx(), id)
if err != nil {
return err
Expand Down Expand Up @@ -375,7 +375,7 @@ func warningPut(d *Daemon, r *http.Request) response.Response {
return response.Forbidden(fmt.Errorf(`Status may only be set to "acknowledge" or "new"`))
}

err = s.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
err = s.DB.Cluster.Transaction(r.Context(), func(ctx context.Context, tx *db.ClusterTx) error {
err := tx.UpdateWarningStatus(id, status)
if err != nil {
return err
Expand Down Expand Up @@ -418,7 +418,7 @@ func warningDelete(d *Daemon, r *http.Request) response.Response {
return response.SmartError(err)
}

err = s.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
err = s.DB.Cluster.Transaction(r.Context(), func(ctx context.Context, tx *db.ClusterTx) error {
err := cluster.DeleteWarning(ctx, tx.Tx(), id)
if err != nil {
return err
Expand Down Expand Up @@ -469,7 +469,7 @@ func pruneResolvedWarningsTask(d *Daemon) (task.Func, task.Schedule) {
}

func pruneResolvedWarnings(ctx context.Context, s *state.State) error {
err := s.DB.Cluster.Transaction(context.TODO(), func(ctx context.Context, tx *db.ClusterTx) error {
err := s.DB.Cluster.Transaction(ctx, func(ctx context.Context, tx *db.ClusterTx) error {
// Retrieve warnings by resolved status.
statusResolved := warningtype.StatusResolved
filter := cluster.WarningFilter{
Expand Down

0 comments on commit f6a0a38

Please sign in to comment.