vona-module-a-startup 5.0.24 → 5.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -37
- package/dist/service/startup.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,42 +34,13 @@ let ServiceStartup = (_dec$3 = Service(), _dec2$3 = BeanInfo({
|
|
|
34
34
|
|
|
35
35
|
// version init : force: should be false
|
|
36
36
|
if (this.app.meta.isTest || this.app.meta.isDev) {
|
|
37
|
-
|
|
38
|
-
await this.bean.executor.newCtx(async () => {
|
|
39
|
-
await this.$scope.instance.service.instance.instanceStartup(instanceName, {
|
|
40
|
-
force: false
|
|
41
|
-
});
|
|
42
|
-
}, {
|
|
43
|
-
dbInfo: {
|
|
44
|
-
level: 1
|
|
45
|
-
},
|
|
46
|
-
instanceName
|
|
47
|
-
});
|
|
37
|
+
await this._appReadyInstanceStartup('', true);
|
|
48
38
|
} else {
|
|
49
|
-
//
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
level: 1
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
for (const instance of instances) {
|
|
58
|
-
const instanceName = instance.name;
|
|
59
|
-
// need not await
|
|
60
|
-
const res = this.bean.executor.newCtx(async () => {
|
|
61
|
-
await this.$scope.instance.service.instance.instanceStartup(instanceName, {
|
|
62
|
-
force: false
|
|
63
|
-
});
|
|
64
|
-
}, {
|
|
65
|
-
dbInfo: {
|
|
66
|
-
level: 1
|
|
67
|
-
},
|
|
68
|
-
instanceName
|
|
69
|
-
});
|
|
70
|
-
if (this.app.config.server.listen.disable) {
|
|
71
|
-
await res;
|
|
72
|
-
}
|
|
39
|
+
// only start static instances (defined in config)
|
|
40
|
+
for (const configInstanceBase of this.app.config.instances) {
|
|
41
|
+
// need not await for prod
|
|
42
|
+
const wait = this.app.config.server.listen.disable;
|
|
43
|
+
await this._appReadyInstanceStartup(configInstanceBase.name, wait);
|
|
73
44
|
}
|
|
74
45
|
}
|
|
75
46
|
|
|
@@ -86,6 +57,14 @@ let ServiceStartup = (_dec$3 = Service(), _dec2$3 = BeanInfo({
|
|
|
86
57
|
});
|
|
87
58
|
}
|
|
88
59
|
}
|
|
60
|
+
async _appReadyInstanceStartup(instanceName, wait) {
|
|
61
|
+
const res = this.$scope.instance.service.instance.instanceStartupIsolate(instanceName, {
|
|
62
|
+
force: false
|
|
63
|
+
});
|
|
64
|
+
if (wait) {
|
|
65
|
+
await res;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
89
68
|
async runStartup(startupName, instanceName, options) {
|
|
90
69
|
const startup = this.bean.onion.startup.onionsNormal[startupName];
|
|
91
70
|
const startupOptions = startup.beanOptions.options;
|
|
@@ -184,10 +163,10 @@ const __ThisModule__ = 'a-startup';
|
|
|
184
163
|
|
|
185
164
|
class Monkey extends BeanSimple {
|
|
186
165
|
async appStart() {
|
|
187
|
-
await this.
|
|
166
|
+
await this.app.scope(__ThisModule__).service.startup.appStart();
|
|
188
167
|
}
|
|
189
168
|
async appReady() {
|
|
190
|
-
await this.
|
|
169
|
+
await this.app.scope(__ThisModule__).service.startup.appReady();
|
|
191
170
|
}
|
|
192
171
|
}
|
|
193
172
|
|
|
@@ -5,6 +5,7 @@ import { BeanBase } from 'vona';
|
|
|
5
5
|
export declare class ServiceStartup extends BeanBase {
|
|
6
6
|
appStart(): Promise<void>;
|
|
7
7
|
appReady(): Promise<void>;
|
|
8
|
+
private _appReadyInstanceStartup;
|
|
8
9
|
runStartup(startupName: string, instanceName?: keyof IInstanceRecord | null, options?: IInstanceStartupOptions): Promise<void>;
|
|
9
10
|
_runStartupLock<T extends keyof IStartupRecord>(startup: IOnionSlice<IStartupRecord, T>, instanceName?: keyof IInstanceRecord | null, options?: IInstanceStartupOptions): Promise<void>;
|
|
10
11
|
_runStartupInner<T extends keyof IStartupRecord>(startup: IOnionSlice<IStartupRecord, T>, instanceName?: keyof IInstanceRecord | null, options?: IInstanceStartupOptions): Promise<void>;
|