fix(app-supervisor): wrong logic in app init (#1489)
This causes to return `initializating` when even accessing a non-existed app for the first time. Reviewed-on: daoyoucloud/tachybase#1489 Reviewed-by: sealday <zhanglin@daoyoucloud.com> Co-authored-by: TomyJan <TomyJan6@gmail.com> Co-committed-by: TomyJan <TomyJan6@gmail.com>
This commit is contained in:
parent
6b9e9624eb
commit
b283363da3
@ -127,7 +127,9 @@ export class AppSupervisor extends EventEmitter implements AsyncEmitter {
|
||||
async bootStrapApp(appName: string, options = {}) {
|
||||
await this.getMutexOfApp(appName).runExclusive(async () => {
|
||||
if (!this.hasApp(appName)) {
|
||||
this.setAppStatus(appName, 'initializing');
|
||||
if (!this.getAppStatus(appName)) {
|
||||
this.setAppStatus(appName, 'initializing');
|
||||
}
|
||||
|
||||
if (this.appBootstrapper) {
|
||||
await this.appBootstrapper({
|
||||
|
@ -219,11 +219,7 @@ export class Gateway extends EventEmitter {
|
||||
const handleApp = await this.getRequestHandleAppName(req as IncomingRequest);
|
||||
const log = this.getLogger(handleApp, res);
|
||||
|
||||
const hasApp = AppSupervisor.getInstance().hasApp(handleApp);
|
||||
|
||||
if (!hasApp) {
|
||||
void AppSupervisor.getInstance().bootStrapApp(handleApp);
|
||||
}
|
||||
await AppSupervisor.getInstance().getApp(handleApp);
|
||||
|
||||
let appStatus = AppSupervisor.getInstance().getAppStatus(handleApp, 'initializing');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user