-
Notifications
You must be signed in to change notification settings - Fork 107
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
avoid performing garbage collect on each topology update #118
Conversation
I think I would be happier if we did a garabgeCollect somewhere. |
9665e4a
to
1bb1ce4
Compare
Updated PR to perform garbage collect corresponding to topology updates. Also timer is used trigger garbage collect at scheduled interval which will help coalesce topology updates. |
addressed review comments. PTAL |
25e492a
to
b0ea3b3
Compare
gossip_test.go
Outdated
@@ -66,6 +67,8 @@ func sendPendingGossip(routers ...*Router) { | |||
sentSomething = router.sendPendingGossip() || sentSomething | |||
} | |||
} | |||
// Allow topology to propagate | |||
time.Sleep(1 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this - sendPendingGossip()
is carefully written to wait long enough already.
You could add a new function in peers_test.go
like:
func forcePendingGC(routers ...*Router) {
for _, router := range routers {
router.Peers.Lock()
if router.Peers.pendingGC {
var pending peersPendingNotifications
router.Peers.garbageCollect(&pending)
router.Peers.unlockAndNotify(&pending)
} else {
router.Peers.Unlock()
}
}
}
then call it as necessary?
I note we can't run |
Fixes: #115