fix(query-core): do not schedule garbage collection on the server - #11321
fix(query-core): do not schedule garbage collection on the server#11321AdzerKI wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe query core now skips garbage collection timer scheduling in server environments, including queries with explicit finite ChangesServer garbage collection
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change prevents unnecessary garbage-collection timers during server rendering while preserving client-side scheduling and the existing opt-in server override. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked 问题 checkExplanation The implementation satisfies issue Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2 files. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ce346d7 to
9c52898
比较
🎯 Changes
Fixes #11320.
updateGcTimefalls back toInfinityon the server, so by default nothing is scheduled there. An explicit finitegcTimebypasses that fallback, andscheduleGc()then schedules a timer during server rendering.A Node timer captures the async context it is created in, so it keeps the whole SSR render alive until it fires: the framework's request store, the
react-dom/serverRequest, the produced HTML and the RSC payload. It cannot clean up anything either — the per-request client is unreachable long beforegcTimeelapses.scheduleGc()now returns early on the server. ThegcTimevalue is untouched; nothing else reads it there. Long-lived Node processes that do want garbage collection opt in withenvironmentManager.setIsServer(() => false).Reproduction from the issue — 2000 simulated renders, 512 KB of render context each, forced GC before measuring:
✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request. (Rantest:eslint,test:lib,test:types,test:buildandbuildforquery-coreandreact-query: 647 + 571 tests green.)🚀 Release Impact
Summary by CodeRabbit
Bug Fixes
Tests