fix 40个自定义对象且同时存在db、文件时,服务启动特别慢 #2723

This commit is contained in:
baozhoutao 2022-01-21 14:14:24 +08:00
parent 76a614373e
commit 3f675c7f2b

View File

@ -24,6 +24,7 @@ const _routers: Array<any> = [];
const _objectsData: Dictionary<any> = {};
const delayLoadExtendObjectConfigQueue: Dictionary<any> = {};
let standardObjectsLoaded: boolean = false;
let dbMetadataLoaing: boolean = false;
const addDelayLoadExtendObjectConfig = function (extend: string, config: SteedosObjectTypeConfig){
if(!delayLoadExtendObjectConfigQueue[extend]){
@ -323,10 +324,17 @@ export const removeObjectListenerConfig = (_id, listenTo, when)=>{
}
}
export const loadStandardMetadata = async (serviceName: string, datasourceApiName: string) =>{
export const loadStandardMetadata = async (serviceName: string, datasourceApiName: string) => {
await loadStandardProfiles(serviceName);
await loadStandardPermissionsets(serviceName);
await loadStandardBaseObjects(serviceName);
if (dbMetadataLoaing != true) {
dbMetadataLoaing = true;
await loadDbMetadatas(datasourceApiName);
}
}
export const loadDbMetadatas = async (datasourceApiName: string) => {
if(datasourceApiName === 'default' || datasourceApiName === 'meteor'){
const datasource = getDataSource(datasourceApiName)
if(datasource && datasourceApiName === 'default'){