Skip to content

Commit c6824ca

Browse files
committed
fix: duplicate tags map in mutation to resolve race
See: https://github.com/coder/coder/actions/runs/10149619748/job/28064952716?pr=14046
1 parent 58b810f commit c6824ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

provisionersdk/provisionertags.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ const (
1818
// NOTE: "owner" must NEVER be nil. Otherwise it will end up being
1919
// duplicated in the database, as idx_provisioner_daemons_name_owner_key
2020
// is a partial unique index that includes a JSON field.
21-
func MutateTags(userID uuid.UUID, tags map[string]string) map[string]string {
22-
if tags == nil {
23-
tags = map[string]string{}
21+
func MutateTags(userID uuid.UUID, provided map[string]string) map[string]string {
22+
tags := map[string]string{}
23+
for k, v := range provided {
24+
tags[k] = v
2425
}
2526
_, ok := tags[TagScope]
2627
if !ok {

0 commit comments

Comments
 (0)