fix: when remote watch fails, the callback should not be called

This commit is contained in:
wangxin 2021-11-18 21:26:54 +08:00
parent 7ba3455b88
commit 0f246792b8

View file

@ -1903,7 +1903,9 @@ func (v *Viper) watchKeyValueConfigOnChannel(run func()) error {
b := <-rc b := <-rc
reader := bytes.NewReader(b.Value) reader := bytes.NewReader(b.Value)
v.unmarshalReader(reader, v.kvstore) v.unmarshalReader(reader, v.kvstore)
run() if b.Error == nil {
run()
}
} }
}(respc) }(respc)
return nil return nil