make route calculcation more efficient and properly async
Instead of following the usual actor pattern, we use a 1-place channel with a non-blocking send. Essentially, if there is already a pending recalculation request queued up, there is no point enqueuing another one.
This commit is contained in:
1 parent
acbb911823
commit
7166d151aa
2 files changed
+18
-23
No files matched your search
@@ -21,7 +21,7 @@ type mockChannelConnection struct {
|
||||
func NewTestRouter(name PeerName) *Router {
|
||||
router := NewRouter(nil, name, "", nil, 10, 1024, nil)
|
||||
router.ConnectionMaker.actionChan = make(chan ConnectionMakerAction, ChannelSize)
|
||||
router.Routes.actionChan = make(chan RoutesAction, ChannelSize)
|
||||
router.Routes.recalculate = make(chan *struct{}, 1)
|
||||
return router
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user