feat(tegg): support cooperative async module loading - #468
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (21)
Included review availability: Your plan includes up to 2 reviews per rolling hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe PR adds opt-in asynchronous module loading with configurable event-loop yields. It adds asynchronous loader contracts, deferred graph initialization, queued graph hooks, application configuration, documentation, and tests. ChangesAsynchronous module loading
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This change adds an opt-in asynchronous module-loading path while preserving synchronous loading by default, with focused tests and validation reported; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant Application
participant ModuleHandler
participant EggModuleLoader
participant LoaderFactory
participant ModuleLoader
participant GlobalGraph
Application->>ModuleHandler: registerGlobalGraphBuildHook(hook)
ModuleHandler->>EggModuleLoader: forward hook
Application->>EggModuleLoader: load()
EggModuleLoader->>LoaderFactory: loadAppAsync(options)
LoaderFactory->>ModuleLoader: loadAsync(options)
ModuleLoader-->>LoaderFactory: return loaded classes
LoaderFactory-->>EggModuleLoader: return module descriptors
EggModuleLoader->>GlobalGraph: create and publish graph
EggModuleLoader->>GlobalGraph: apply queued hooks
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
core/common-util/index.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. core/common-util/src/EventLoopYieldUtil.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). core/common-util/test/EventLoopYieldUtil.test.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency).
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 |
Checklist
npm testpassesAffected core subsystem(s)
@eggjs/tegg-common-util@eggjs/tegg-loader@eggjs/tegg-pluginDescription of change
Add an opt-in cooperative asynchronous TEgg module loading path while keeping the existing synchronous behavior as the default.
config.tegg.asyncLoadandasyncLoadYieldIntervalMs(default: 50ms per module)requirecalls when the configured time slice is reachedrequire, including its transitive imports, synchronous and non-preemptibleValidation performed:
@eggjs/tegg-loader: 5 tests passingEventLoopYieldUtil: 3 tests passingEggModuleLoaderfocused tests: 3 tests passing--noEmitchecks for common-util, loader, and tegg pluginSummary by CodeRabbit
asyncLoadandasyncLoadYieldIntervalMs.