refactor: move index creation to onServerVersionChange#39253
refactor: move index creation to onServerVersionChange#39253
Conversation
- Remove createIndexes() call from BaseRaw constructor to avoid thundering herd of index creation on every model instantiation - Add ensureAllIndexes() in proxify to run createIndexes on all registered models - Call ensureAllIndexes() inside onServerVersionChange callback in xrun.ts so indexes are created only on first start or when server version (commit hash) changes - Reduces MongoDB load during normal restarts Made-with: Cursor
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
Fetch all settings in one MongoDB round-trip instead of streaming with forEach to reduce startup time when there is network latency. Made-with: Cursor
Made-with: Cursor
- Fetch all settings in one MongoDB round-trip with toArray() - Add setBulk() to CachedSettings to fill store without N ready listeners - Reduces startup time and memory churn during settings init Made-with: Cursor
…psertPermissions
- Build updateOne ops for all settings, run in batches of 500 via bulkWrite
- Use deleteMany for obsolete permissions instead of N deleteOne calls
- Keeps createSettingPermission for the settings.on('*') callback (single setting at runtime)
Made-with: Cursor
- Process apps in chunks of CONCURRENCY_LIMIT (4) with Promise.all - Each chunk runs canEnableApp + loadOne in parallel, then next chunk - Preserves app limit semantics by waiting for chunk before starting next Made-with: Cursor
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #39253 +/- ##
===========================================
+ Coverage 70.72% 70.89% +0.17%
===========================================
Files 3195 3208 +13
Lines 113108 113448 +340
Branches 20479 20527 +48
===========================================
+ Hits 79991 80427 +436
+ Misses 31067 30973 -94
+ Partials 2050 2048 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Made-with: Cursor
Proposed changes (including videos or screenshots)
Issue(s)
Steps to test or reproduce
Further comments