Skip to content

Commit a109967

Browse files
authored
add lock (apache#1304)
1 parent 42ef7fe commit a109967

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

config/config_loader.go

+4
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,8 @@ func GetApplicationConfig() *ApplicationConfig {
451451
// if not found, create new one
452452
func GetProviderConfig() ProviderConfig {
453453
if providerConfig == nil {
454+
configAccessMutex.Lock()
455+
defer configAccessMutex.Unlock()
454456
if providerConfig == nil {
455457
return ProviderConfig{}
456458
}
@@ -465,6 +467,8 @@ func GetProviderConfig() ProviderConfig {
465467
// So you don't need to worry about the race condition
466468
func GetConsumerConfig() ConsumerConfig {
467469
if consumerConfig == nil {
470+
configAccessMutex.Lock()
471+
defer configAccessMutex.Unlock()
468472
if consumerConfig == nil {
469473
return ConsumerConfig{}
470474
}

0 commit comments

Comments
 (0)