diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index 7412d2cd..742496ff 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -248,19 +248,19 @@ export class ImportDataController extends Controller { profileEmp.createdFullName = request.user.name; profileEmp.lastUpdateUserId = request.user.sub; profileEmp.lastUpdateFullName = request.user.name; - // profiles.push(profileEmp); + profiles.push(profileEmp); console.log(">>>>>>>>>>>>>>>>>>>" + rowCount); - // if (profiles.length === BATCH_SIZE) { - await this.profileEmpRepo.save(profileEmp); - // profiles = await []; - // if (global.gc) { - // global.gc(); - // } - // } + if (profiles.length === BATCH_SIZE) { + await this.profileEmpRepo.save(profiles); + profiles = await []; + if (global.gc) { + global.gc(); + } + } } console.log(rowCount); - // await this.profileEmpRepo.save(profiles); + await this.profileEmpRepo.save(profiles); return new HttpSuccess(); } @@ -338,7 +338,7 @@ export class ImportDataController extends Controller { profileSalary.lastUpdateFullName = request.user.name; profileSalarys.push(profileSalary); // await this.salaryRepository.save(profileSalary); - if (profiles.length === BATCH_SIZE) { + if (profileSalarys.length === BATCH_SIZE) { await this.salaryRepository.save(profileSalarys); profileSalarys = await []; }