From b9316ab2cc1e9abedd21842b4e74971e3ccb415b Mon Sep 17 00:00:00 2001 From: Kittapath Date: Wed, 31 Jul 2024 10:57:24 +0700 Subject: [PATCH] no message --- src/controllers/ImportDataController.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 []; }