Skip to content

Commit

Permalink
fix data race
Browse files Browse the repository at this point in the history
  • Loading branch information
lyt122 committed Sep 13, 2024
1 parent c67b062 commit 61e3b05
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controller/registries/nacos/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ func (reg *Nacos) Reload(c registrytype.RegistryConfig) error {

reg.version = config.Version

reg.lock.Lock()
defer reg.lock.Unlock()

cli, err := reg.createClient(config)
if err != nil {
return err
}
reg.client = cli

reg.lock.Lock()
defer reg.lock.Unlock()

fetchedServices, err := reg.client.FetchAllServices()
if err != nil {
return fmt.Errorf("fetch all services error: %v", err)
Expand Down

0 comments on commit 61e3b05

Please sign in to comment.