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