release manager Rlock (#18773)

Signed-off-by: wanggang11335 <wanggang11335@autohome.com.cn>

Signed-off-by: wanggang11335 <wanggang11335@autohome.com.cn>
Co-authored-by: wanggang11335 <wanggang11335@autohome.com.cn>
This commit is contained in:
wgcn 2022-08-23 10:56:52 +08:00 committed by GitHub
parent 0c9a10e8f8
commit 16ccefc678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,7 @@ func (m *Manager) GetConfig(key string) (string, error) {
//GetConfigsByPattern returns key values that matched pattern //GetConfigsByPattern returns key values that matched pattern
func (m *Manager) GetConfigsByPattern(pattern string) map[string]string { func (m *Manager) GetConfigsByPattern(pattern string) map[string]string {
m.RLock() m.RLock()
defer m.RLock() defer m.RUnlock()
matchedConfig := make(map[string]string) matchedConfig := make(map[string]string)
pattern = strings.ToLower(pattern) pattern = strings.ToLower(pattern)
for key, value := range m.keySourceMap { for key, value := range m.keySourceMap {
@ -86,7 +86,7 @@ func (m *Manager) GetConfigsByPattern(pattern string) map[string]string {
// Configs returns all the key values // Configs returns all the key values
func (m *Manager) Configs() map[string]string { func (m *Manager) Configs() map[string]string {
m.RLock() m.RLock()
defer m.RLock() defer m.RUnlock()
config := make(map[string]string) config := make(map[string]string)
for key, value := range m.keySourceMap { for key, value := range m.keySourceMap {