pull/455/head
wenxu12345 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 83b33771f4
commit d88036758b

@ -159,20 +159,20 @@ func (r *Resolver) watch(prefix string, addrList []resolver.Address) {
if !exists(addrList, string(ev.Kv.Value)) { if !exists(addrList, string(ev.Kv.Value)) {
flag = 1 flag = 1
addrList = append(addrList, resolver.Address{Addr: string(ev.Kv.Value)}) addrList = append(addrList, resolver.Address{Addr: string(ev.Kv.Value)})
//log.Debug("", "after add, new list: ", addrList) log.Debug("", "after add, new list: ", addrList)
} }
case mvccpb.DELETE: case mvccpb.DELETE:
//log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value)) log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value))
i := strings.LastIndexAny(string(ev.Kv.Key), "/") i := strings.LastIndexAny(string(ev.Kv.Key), "/")
if i < 0 { if i < 0 {
return return
} }
t := string(ev.Kv.Key)[i+1:] t := string(ev.Kv.Key)[i+1:]
//log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value), "addr:", t) log.Debug("remove addr key: ", string(ev.Kv.Key), "value:", string(ev.Kv.Value), "addr:", t)
if s, ok := remove(addrList, t); ok { if s, ok := remove(addrList, t); ok {
flag = 1 flag = 1
addrList = s addrList = s
//log.Debug("after remove, new list: ", addrList) log.Debug("after remove, new list: ", addrList)
} }
} }
} }

Loading…
Cancel
Save