Skip to content

fix: duplicate tags map in mutation to resolve race #14047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: duplicate tags map in mutation to resolve race
  • Loading branch information
kylecarbs committed Jul 29, 2024
commit c6824ca145db47214151985d9fa54c863e4d3d11
7 changes: 4 additions & 3 deletions provisionersdk/provisionertags.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const (
// NOTE: "owner" must NEVER be nil. Otherwise it will end up being
// duplicated in the database, as idx_provisioner_daemons_name_owner_key
// is a partial unique index that includes a JSON field.
func MutateTags(userID uuid.UUID, tags map[string]string) map[string]string {
if tags == nil {
tags = map[string]string{}
func MutateTags(userID uuid.UUID, provided map[string]string) map[string]string {
tags := map[string]string{}
for k, v := range provided {
tags[k] = v
}
_, ok := tags[TagScope]
if !ok {
Expand Down
Loading