fix(rivetkit): restore waitForNames and fix queue type errors#4116
fix(rivetkit): restore waitForNames and fix queue type errors#4116NathanFlurry wants to merge 1 commit intomainfrom
Conversation
|
🚅 Deployed to the rivet-pr-4116 environment in rivet-frontend
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
PR Review: fix(rivetkit): restore waitForNames and fix queue type errorsSummaryThis PR restores the ✅ Strengths
🔍 Code Quality & Best Practicesqueue-manager.ts:366-415The
queue-manager.ts:540-557The notification logic looks good. Spreading the set ( queue.ts:101-104Good fix. The method now properly converts the internal queue message format to the public 🐛 Potential Issues
🔐 Security ConsiderationsNo security concerns identified. The abort signal handling prevents resource leaks and denial-of-service from accumulated listeners. ⚡ Performance Considerations
📝 Documentation
🧪 Testing RecommendationsAdd tests for:
✏️ Minor Suggestions
📊 Overall AssessmentQuality: ⭐⭐⭐⭐ (4/5) This is a solid implementation that restores important functionality. The main improvements would be:
The code is production-ready with the suggestion to add tests before merging. ✅ RecommendationApprove with minor suggestions. Consider adding test coverage for the restored |
ee7f334 to
a46d0d1
Compare
a46d0d1 to
432fcd6
Compare
| if (abortSignal) { | ||
| const onAbort = () => | ||
| listener.reject(new errors.ActorAborted()); | ||
| if (abortSignal.aborted) { | ||
| onAbort(); | ||
| return; | ||
| } | ||
| abortSignal.addEventListener("abort", onAbort, { once: true }); | ||
| listener.signalAbortCleanup = () => | ||
| abortSignal.removeEventListener("abort", onAbort); | ||
| } |
There was a problem hiding this comment.
Memory leak: When abortSignal is already aborted, the code calls onAbort() and returns early (lines 406-408). However, the actor abort signal listener was already registered (line 397) but never gets cleaned up because the listener hasn't been added to #messageListeners yet (line 415). The #removeMessageListener method only calls cleanup callbacks for listeners in the set.
Fix: Manually call cleanup before early return:
if (abortSignal.aborted) {
listener.actorAbortCleanup?.();
onAbort();
return;
}| if (abortSignal) { | |
| const onAbort = () => | |
| listener.reject(new errors.ActorAborted()); | |
| if (abortSignal.aborted) { | |
| onAbort(); | |
| return; | |
| } | |
| abortSignal.addEventListener("abort", onAbort, { once: true }); | |
| listener.signalAbortCleanup = () => | |
| abortSignal.removeEventListener("abort", onAbort); | |
| } | |
| if (abortSignal) { | |
| const onAbort = () => | |
| listener.reject(new errors.ActorAborted()); | |
| if (abortSignal.aborted) { | |
| listener.actorAbortCleanup?.(); | |
| onAbort(); | |
| return; | |
| } | |
| abortSignal.addEventListener("abort", onAbort, { once: true }); | |
| listener.signalAbortCleanup = () => | |
| abortSignal.removeEventListener("abort", onAbort); | |
| } |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Merge activity
|
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. ## Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: