Dialogue ChannelCache uses weak values to allow collection of old data #2194
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.
Before this PR
The inclusion of resolved IP addresses in channels caused the cache to become full over time, when hosts are rotated naturally over time. This behavior is desirable, because we're able to account for individual nodes/routes in dialogue node selection, however the channel cache didn't have a way to forget old targets.
After this PR
==COMMIT_MSG==
Dialogue ChannelCache uses weak values to allow collection of old data
==COMMIT_MSG==
Possible downsides?
It's possible that creation of a single client in a loop will re-create the same data, and allow it to be collected, re-running the same work more than we'd like. This is unlikely, as clients are generally created and held via strong references, and hot re-creation of channels is an anti-pattern.