Skip to content

Commit

Permalink
config client cache data race (#645)
Browse files Browse the repository at this point in the history
* refine
  • Loading branch information
binbin0325 authored Aug 7, 2023
1 parent d4949e1 commit b51d87d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions clients/config_client/config_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,15 +438,16 @@ func (client *ConfigClient) executeConfigListen() {
}
}

for _, v := range caches {
changeKey := util.GetConfigCacheKey(v.dataId, v.group, v.tenant)
for _, v := range client.cacheMap.Items() {
data := v.(cacheData)
changeKey := util.GetConfigCacheKey(data.dataId, data.group, data.tenant)
if _, ok := changeKeys[changeKey]; !ok {
v.isSyncWithServer = true
client.cacheMap.Set(changeKey, v)
data.isSyncWithServer = true
client.cacheMap.Set(changeKey, data)
continue
}
v.isInitializing = true
client.cacheMap.Set(changeKey, v)
data.isInitializing = true
client.cacheMap.Set(changeKey, data)
}

}
Expand Down

0 comments on commit b51d87d

Please sign in to comment.