Fixes a goroutine leak caused by not cleaning up idle node handlers. The map would grow to contain an entry and a corresponding work queue goroutine for every peer node ever contacted. This change keeps track of when a node handler was last used and removes ones that are deemed to be idle, cleaning up the goroutine at the same time.
Also reworks the network behaviour to follow the new behaviour notify/perform pattern and adds some configuration for logging and tracing.
Thunderdome testing shows goroutines remain steady with the fix and other resource utilization is the same or better.
Fixes a goroutine leak caused by not cleaning up idle node handlers. The map would grow to contain an entry and a corresponding work queue goroutine for every peer node ever contacted. This change keeps track of when a node handler was last used and removes ones that are deemed to be idle, cleaning up the goroutine at the same time.
Also reworks the network behaviour to follow the new behaviour notify/perform pattern and adds some configuration for logging and tracing.
Thunderdome testing shows goroutines remain steady with the fix and other resource utilization is the same or better.
Thunderdome test before fix: 10 reqs/sec
Thunderdome test after fix: 10 reqs/sec and 20 reqs/sec