Skip to content

Commit

Permalink
feat: add load units function (#153)
Browse files Browse the repository at this point in the history
<!--
Thank you for your pull request. Please review below requirements.
Bug fixes and new features should include tests and possibly benchmarks.
Contributors guide:
https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md

感谢您贡献代码。请确认下列 checklist 的完成情况。
Bug 修复和新功能必须包含测试,必要时请附上性能测试。
Contributors guide:
https://github.com/eggjs/egg/blob/master/CONTRIBUTING.md
-->

##### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to
[x]. -->

- [ ] `npm test` passes
- [ ] tests and/or benchmarks are included
- [ ] documentation is changed or added
- [ ] commit message follows commit guidelines

##### Affected core subsystem(s)
<!-- Provide affected core subsystem(s). -->


##### Description of change
<!-- Provide a description of the change below this comment. -->

<!--
- any feature?
- close https://github.com/eggjs/egg/ISSUE_URL
-->
  • Loading branch information
gxkl authored Sep 15, 2023
1 parent 7bd1891 commit ea75fdc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions standalone/standalone/src/Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class Runner {
LoadUnitLifecycleUtil.registerLifecycle(this.loadUnitMultiInstanceProtoHook);
}

async init() {
async load() {
StandaloneContextHandler.register();
LoadUnitFactory.registerLoadUnitCreator(StandaloneLoadUnitType, () => {
return new StandaloneLoadUnit(this.innerObjects);
Expand All @@ -146,8 +146,11 @@ export class Runner {
},
});
const loadUnits = await this.loadUnitLoader.load();
this.loadUnits = [ standaloneLoadUnit, ...loadUnits ];
return [ standaloneLoadUnit, ...loadUnits ];
}

async init() {
this.loadUnits = await this.load();
const instances: LoadUnitInstance[] = [];
for (const loadUnit of this.loadUnits) {
const instance = await LoadUnitInstanceFactory.createLoadUnitInstance(loadUnit);
Expand Down

0 comments on commit ea75fdc

Please sign in to comment.