fix watchKeyValueConfigOnChannel panic when remote config update

This commit is contained in:
yejiangming 2022-05-25 22:33:47 +08:00
parent 5d65186f1e
commit 104f9d0771

View file

@ -1882,7 +1882,9 @@ func (v *Viper) watchKeyValueConfigOnChannel() error {
for {
b := <-rc
reader := bytes.NewReader(b.Value)
v.unmarshalReader(reader, v.kvstore)
kvstore := make(map[string]interface{})
v.unmarshalReader(reader, kvstore)
v.kvstore = kvstore
}
}(respc)
return nil