Fix race with tags (#12041)

This commit is contained in:
Chris S. Kim 2022-01-12 11:24:51 -05:00 committed by GitHub
parent 29e07eb48c
commit 4330a6a21a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1086,8 +1086,9 @@ func (l *State) updateSyncState() error {
// copy so that we don't retain a pointer to any actual state
// store info for in-memory RPCs.
if ls.Service.EnableTagOverride {
ls.Service.Tags = make([]string, len(rs.Tags))
copy(ls.Service.Tags, rs.Tags)
tags := make([]string, len(rs.Tags))
copy(tags, rs.Tags)
ls.Service.Tags = tags
}
// Merge any tagged addresses with the consul- prefix (set by the server)