Skip to content
Snippets Groups Projects
Commit 21538ceb authored by pantianying's avatar pantianying
Browse files

update

parents 9e9f5bba c9294c47
No related branches found
No related tags found
No related merge requests found
......@@ -299,30 +299,26 @@ func (z *ZookeeperClient) UnregisterEvent(zkPath string, event *chan struct{}) {
if zkPath == "" {
return
}
z.Lock()
//for {
a, ok := z.eventRegistry[zkPath]
defer z.Unlock()
infoList, ok := z.eventRegistry[zkPath]
if !ok {
return
//break
}
for i, e := range a {
for i, e := range infoList {
if e == event {
arr := a
a = append(arr[:i], arr[i+1:]...)
arr := infoList
infoList = append(arr[:i], arr[i+1:]...)
logger.Debugf("zkClient{%s} unregister event{path:%s, event:%p}", z.name, zkPath, event)
}
}
logger.Debugf("after zkClient{%s} unregister event{path:%s, event:%p}, array length %d",
z.name, zkPath, event, len(a))
if len(a) == 0 {
z.name, zkPath, event, len(infoList))
if len(infoList) == 0 {
delete(z.eventRegistry, zkPath)
} else {
z.eventRegistry[zkPath] = a
z.eventRegistry[zkPath] = infoList
}
//}
z.Unlock()
}
func (z *ZookeeperClient) Done() <-chan struct{} {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment