in pkg/config/api_config.go [290:336]
func handleDeleteEvent(key, val []byte) {
lock.Lock()
defer lock.Unlock()
keyStr := string(key)
keyStr = strings.TrimSuffix(keyStr, "/")
re := getCheckResourceRegexp()
if m := re.Match(key); m {
pathArray := strings.Split(keyStr, "/")
if len(pathArray) == 0 {
logger.Errorf("handleDeleteEvent key format error")
return
}
resourceIdStr := pathArray[len(pathArray)-1]
ID, err := strconv.Atoi(resourceIdStr)
if err != nil {
logger.Errorf("handleDeleteEvent ID is not int error %s", err)
return
}
deleteApiConfigResource(ID)
return
}
re = getExtractMethodRegexp()
if m := re.Match(key); m {
pathArray := strings.Split(keyStr, "/")
if len(pathArray) < 3 {
logger.Errorf("handleDeleteEvent key format error")
return
}
resourceIdStr := pathArray[len(pathArray)-3]
resourceId, err := strconv.Atoi(resourceIdStr)
if err != nil {
logger.Errorf("handleDeleteEvent ID is not int error %s", err)
return
}
methodIdStr := pathArray[len(pathArray)-1]
methodId, err := strconv.Atoi(methodIdStr)
if err != nil {
logger.Errorf("handleDeleteEvent ID is not int error %s", err)
return
}
deleteApiConfigMethod(resourceId, methodId)
}
}