Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FixBug: can't delete node by path #201

Merged
merged 10 commits into from
Jul 4, 2021
3 changes: 1 addition & 2 deletions pkg/config/api_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,8 @@ func listenResourceAndMethodEvent(key string) bool {
case mvccpb.DELETE:
logger.Infof("get event (key{%s}) = event{EventNodeDeleted}", event.Kv.Key)
handleDeleteEvent(event.Kv.Key, event.Kv.Value)
return true
default:
return false
logger.Infof("get event (key{%s}) = event{%d}", event.Kv.Key, event.Type)
}
}
}
Expand Down
11 changes: 4 additions & 7 deletions pkg/router/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ func (rt *Route) FindAPI(fullPath string, httpverb config.HTTPVerb) (*router.API
// DeleteNode delete node by fullPath
func (rt *Route) DeleteNode(fullPath string) bool {
lowerPath := strings.ToLower(fullPath)
if _, found := rt.searchWildcard(lowerPath); found {
rt.lock.RLock()
defer rt.lock.RUnlock()
rt.tree.Remove(lowerPath)
return true
}
return false
rt.lock.RLock()
defer rt.lock.RUnlock()
rt.tree.Remove(lowerPath)
return true
}

// DeleteAPI delete api by fullPath and http verb
Expand Down