Skip to content

Commit

Permalink
fix(cdn): update query to use index (#5873)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Jul 6, 2021
1 parent a7b0f36 commit cf7caf9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions engine/cdn/item/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package item

import (
"context"
"strconv"
"time"

"github.com/go-gorp/gorp"
Expand Down Expand Up @@ -145,10 +146,11 @@ func Update(ctx context.Context, m *gorpmapper.Mapper, db gorpmapper.SqlExecutor
}

func MarkToDeleteByRunIDs(db gorpmapper.SqlExecutorWithTx, runID int64) error {
runIdS := strconv.FormatInt(runID, 10)
query := `
UPDATE item SET to_delete = true WHERE (api_ref->>'run_id')::int = $1
UPDATE item SET to_delete = true WHERE api_ref->>'run_id' = $1
`
_, err := db.Exec(query, runID)
_, err := db.Exec(query, runIdS)
return sdk.WrapError(err, "unable to mark item to delete for run %d", runID)
}

Expand Down

0 comments on commit cf7caf9

Please sign in to comment.