fix(message): bound trace request cache - #3298
Open
tju-yxq wants to merge 1 commit into
Open
Conversation
RockteMQ-AI
approved these changes
Sep 5, 2026
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR replaces the unbounded Map used for trace request caching with a well-implemented LRU cache (BoundedPromiseCache) capped at 32 entries. This prevents memory leaks during long investigation sessions where many distinct messages are explored.
Strengths:
- Clean LRU implementation using Map insertion order
- Proper recency refresh on get() (delete + re-set)
- Good test coverage: capacity validation, eviction, replacement, deletion, cleanup
- Correct handling of rejected promises (removed from cache to allow retry)
- Proper input validation (maxEntries must be positive integer)
No blocking issues found. The implementation is solid and follows best practices.
*Automated review by *
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.
What changed
Message Explorer deduplicates trace lookups in a page-local
Map, but successful promises were retained indefinitely. A long investigation session with many distinct messages could therefore keep every resolved trace response referenced until the page was destroyed.This change replaces the unbounded map with a small LRU promise cache:
The cache is page-local and does not alter trace query results or server-side history recording.
Closes #3297
Validation
npm test -- boundedPromiseCache.test.ts --run— 4 tests passednpm test -- MessagePageAsyncState.test.tsx MessagePage.test.tsx --run— 27 tests passednpm run lint -- --quiet— 0 errors; 10 existing warnings remain elsewhere in the treenpm run build— passedgit diff --check— passedThe GitHub Actions status is not being described as green here; the checks above are local validation on this branch.