This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/master by this push:
new a109967 add lock (#1304)
a109967 is described below
commit a10996763e3e1ffa5cdbd80cb49319a4e3626994
Author: tyltr <[email protected]>
AuthorDate: Tue Jul 6 02:13:24 2021 +0800
add lock (#1304)
---
config/config_loader.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/config/config_loader.go b/config/config_loader.go
index 9fc7da4..20d5cf1 100644
--- a/config/config_loader.go
+++ b/config/config_loader.go
@@ -451,6 +451,8 @@ func GetApplicationConfig() *ApplicationConfig {
// if not found, create new one
func GetProviderConfig() ProviderConfig {
if providerConfig == nil {
+ configAccessMutex.Lock()
+ defer configAccessMutex.Unlock()
if providerConfig == nil {
return ProviderConfig{}
}
@@ -465,6 +467,8 @@ func GetProviderConfig() ProviderConfig {
// So you don't need to worry about the race condition
func GetConsumerConfig() ConsumerConfig {
if consumerConfig == nil {
+ configAccessMutex.Lock()
+ defer configAccessMutex.Unlock()
if consumerConfig == nil {
return ConsumerConfig{}
}