fix(config/config):fix type not match bug (#1837)

If the type of new value not match the old one, value stay the old one.
pull/1840/head
Casper-Mars 3 years ago committed by GitHub
parent d6896127b1
commit 5e18a15109
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      config/config.go

@ -86,7 +86,7 @@ func (c *config) watch(w Watcher) {
c.cached.Range(func(key, value interface{}) bool {
k := key.(string)
v := value.(Value)
if n, ok := c.reader.Value(k); ok && !reflect.DeepEqual(n.Load(), v.Load()) {
if n, ok := c.reader.Value(k); ok && reflect.TypeOf(n.Load()) == reflect.TypeOf(v.Load()) && !reflect.DeepEqual(n.Load(), v.Load()) {
v.Store(n.Load())
if o, ok := c.observers.Load(k); ok {
o.(Observer)(k, v)

Loading…
Cancel
Save