feat: prune old, inactive paths #3666
Open
+293
−15
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.
Description
Prune paths that are not actively being used, about to be dialed, or old.
Notes and Questions
The logic of gathering all of the relevant information is in the
fn prune_ip_pathsfunction, not in theself.prune_ip_pathsmethod onEndpointActorState. Separating these out made it easier to test.Used AI to help write tests & reduce allocations when working through the paths.
keep_pathis where we can play around in the future with what exactly we want to keep, based on thePathState, if we want to get more strict or particular as we learn more.Right now we:
This means:
Also, we only do prune this if there are more that 20 inactive paths open.
I've added
prune_ip_pathsanytime we insert a path to theEndpointActorState::paths. However, there are two places I did not add this check, that maybe I should. But my brain is a bit fuzzy right now, so I will do another review about where these checks should go.That being said, I think this is ready for initial review, at least.