Skip to content

Commit

Permalink
Add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkren committed Feb 11, 2020
1 parent 788915d commit 8505c2e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,28 +702,40 @@ func (r *router) rulesGCLoop() {
func (r *router) rulesGC() {
removedRules := r.rt.CollectGarbage()

r.logger.Debugf("Removed %d rules", len(removedRules))

for _, rule := range removedRules {
// we need to process only consume rules, cause we don't
// really care about the other ones, other rules removal
// doesn't affect our work here
if rule.Type() == routing.RuleConsume {
cnsmRuleDesc := rule.RouteDescriptor()
r.logger.Debugf("Removed consume rule with desc %s", &cnsmRuleDesc)
fwdRuleDesc := cnsmRuleDesc.Invert()
rg, ok := r.routeGroup(fwdRuleDesc)
if !ok {
r.logger.Debugln("Couldn't remove route group after consume rule expired: route group not found")
continue
}
r.logger.Debugln("Got route group for removed consume rule with desc %s", &cnsmRuleDesc)

r.removeRouteGroup(fwdRuleDesc)

r.logger.Debugln("Removed route group for removed consume rule with desc %s", &cnsmRuleDesc)

if !rg.isClosed() {
r.logger.Debugln("Closing route group")
// instantly signal to route group that remote is closed, so that we
// won't need to initiate close loop in the network
rg.setRemoteClosed()
r.logger.Debugln("Set remote closed for route group")
if err := rg.Close(); err != nil {
r.logger.Errorf("Error closing route group during rule GC: %v", err)
} else {
r.logger.Debugln("Successfully closed route group")
}
} else {
r.logger.Debugln("Route group is ALREADY closed")
}
}
}
Expand Down

0 comments on commit 8505c2e

Please sign in to comment.