Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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