Browse Source

Merge pull request #7503 from nocodb/nc-fix/at-asy

fix: avoid unnecessary concurrency
pull/7499/head
Mert E 10 months ago committed by GitHub
parent
commit
cc6ba417d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 51
      packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

51
packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts

@ -1824,7 +1824,6 @@ export class AtImportProcessor {
const userList = aTblSchema.appBlanket.userInfoById; const userList = aTblSchema.appBlanket.userInfoById;
const totalUsers = Object.keys(userList).length; const totalUsers = Object.keys(userList).length;
let cnt = 0; let cnt = 0;
const insertJobs: Promise<any>[] = [];
for (const [, value] of Object.entries( for (const [, value] of Object.entries(
userList as { [key: string]: any }, userList as { [key: string]: any },
@ -1833,28 +1832,25 @@ export class AtImportProcessor {
`[${++cnt}/${totalUsers}] NC API auth.baseUserAdd :: ${value.email}`, `[${++cnt}/${totalUsers}] NC API auth.baseUserAdd :: ${value.email}`,
); );
const _perfStart = recordPerfStart(); const _perfStart = recordPerfStart();
insertJobs.push( await this.baseUsersService
this.baseUsersService .userInvite({
.userInvite({ baseId: ncCreatedProjectSchema.id,
baseId: ncCreatedProjectSchema.id, baseUser: {
baseUser: { email: value.email,
email: value.email, roles: userRoles[value.permissionLevel],
roles: userRoles[value.permissionLevel], },
}, req: { user: syncDB.user, clientIp: '' },
req: { user: syncDB.user, clientIp: '' }, })
}) .catch((e) => {
.catch((e) => { if (e.message) {
if (e.message) { // TODO enable after fixing user invite role issue
// TODO enable after fixing user invite role issue // logWarning(e.message);
// logWarning(e.message); } else {
} else { logger.log(e);
logger.log(e); }
} });
}),
);
recordPerfStats(_perfStart, 'auth.baseUserAdd'); recordPerfStats(_perfStart, 'auth.baseUserAdd');
} }
await Promise.all(insertJobs);
}; };
const updateNcTblSchema = (tblSchema) => { const updateNcTblSchema = (tblSchema) => {
@ -2080,19 +2076,18 @@ export class AtImportProcessor {
if (filter.operator === 'doesNotContain') { if (filter.operator === 'doesNotContain') {
filter.operator = 'isNoneOf'; filter.operator = 'isNoneOf';
} }
for (let j = 0; j < filter.value.length; j++) {
filter.value[j] = await sMap.getNcNameFromAtId(filter.value[j]);
}
// if array, break it down to multiple filters // if array, break it down to multiple filters
if (Array.isArray(filter.value)) { if (Array.isArray(filter.value)) {
const fx = { const fx = {
fk_column_id: columnId, fk_column_id: columnId,
logical_op: f.conjunction, logical_op: f.conjunction,
comparison_op: filterMap[filter.operator], comparison_op: filterMap[filter.operator],
value: ( value: filter.value.join(','),
await Promise.all(
filter.value.map(
async (f) => await sMap.getNcNameFromAtId(f),
),
)
).join(','),
}; };
ncFilters.push(fx); ncFilters.push(fx);
} }

Loading…
Cancel
Save