relay: walk cached track stats in place - #627
Merged
Merged
Conversation
akash-a-n
approved these changes
Aug 25, 2026
akash-a-n
left a comment
Contributor
There was a problem hiding this comment.
@akash-a-n reviewed 5 files and all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on afrind).
/state's cache section went through MoqxCache::getTrackStats(), which copies
every track name and allocates a group vector per track, so the walk could
serialize the snapshot and then drop it.
forEachTrackStats hands the visitor a TrackStatsView borrowing the cache's own
data, reusing one group vector across tracks; returning false stops the walk.
The visitor's cache callback splits to match:
visitor.onCacheBegin(bytes, now);
cache_->forEachTrackStats([&](const auto& t) { return visitor.onCacheTrack(t); });
visitor.onCacheEnd();
getTrackStats() stays for callers that want a snapshot, now implemented on top
of the walk -- so MoqxCacheTest covers both. Tracks are visited in the same
order, so the JSON is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
afrind
force-pushed
the
relay/walk-cached-track-stats
branch
from
August 26, 2026 16:07
3d67250 to
2260922
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
/state's cache section went through MoqxCache::getTrackStats(), which copies every track name and allocates a group vector per track, so the walk could serialize the snapshot and then drop it.
forEachTrackStats hands the visitor a TrackStatsView borrowing the cache's own data, reusing one group vector across tracks; returning false stops the walk. The visitor's cache callback splits to match:
getTrackStats() stays for callers that want a snapshot, now implemented on top of the walk -- so MoqxCacheTest covers both. Tracks are visited in the same order, so the JSON is unchanged.
This change is