Skip to content

Commit

Permalink
Merge pull request #1220 from flanksource/canary-conflict-update
Browse files Browse the repository at this point in the history
fix: only update labels and spec for canaries on conflict
  • Loading branch information
moshloop authored Aug 15, 2023
2 parents 173f5b5 + ab7d271 commit c5ae936
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/db/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func PersistCanaryModel(model pkg.Canary) (*pkg.Canary, map[string]string, bool,
changed := false
tx := Gorm.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "agent_id"}, {Name: "name"}, {Name: "namespace"}, {Name: "source"}},
UpdateAll: true,
DoUpdates: clause.AssignmentColumns([]string{"labels", "spec"}),
}).Create(&model)
if tx.RowsAffected > 0 {
changed = true
Expand Down

0 comments on commit c5ae936

Please sign in to comment.