fix(multi-app-manager): sub-app asynchronous quick start (#5571)

This commit is contained in:
chenos 2024-11-03 17:09:12 +08:00 committed by GitHub
parent 08ce9fa923
commit 17582e9351
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,10 @@ import lodash from 'lodash';
import path from 'path';
import { ApplicationModel } from '../server';
export type AppDbCreator = (app: Application, options?: Transactionable & { context?: any }) => Promise<void>;
export type AppDbCreator = (
app: Application,
options?: Transactionable & { context?: any; applicationModel?: ApplicationModel },
) => Promise<void>;
export type AppOptionsFactory = (appName: string, mainApp: Application) => any;
export type SubAppUpgradeHandler = (mainApp: Application) => Promise<void>;
@ -189,9 +192,11 @@ export class PluginMultiAppManagerServer extends Plugin {
appOptionsFactory: this.appOptionsFactory,
});
const quickstart = async () => {
// create database
await this.appDbCreator(subApp, {
transaction,
applicationModel: model,
context: options.context,
});
@ -200,6 +205,9 @@ export class PluginMultiAppManagerServer extends Plugin {
if (options?.context?.waitSubAppInstall) {
await startPromise;
}
};
quickstart();
},
);