fix: timeout in some case
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Methapon2001 2025-09-16 11:52:13 +07:00
parent 0772e4710a
commit 158a6ff163

View file

@ -62,7 +62,8 @@ export async function initThailandAreaDatabase() {
return result; return result;
} }
await prisma.$transaction(async (tx) => { await prisma.$transaction(
async (tx) => {
const meta = { const meta = {
createdBy: null, createdBy: null,
createdAt: new Date(), createdAt: new Date(),
@ -140,7 +141,11 @@ export async function initThailandAreaDatabase() {
.execute(); .execute();
}), }),
); );
}); },
{
timeout: 15_000,
},
);
console.log("[INFO]: Sync thailand province, district and subdistrict, OK."); console.log("[INFO]: Sync thailand province, district and subdistrict, OK.");
} }
@ -170,7 +175,8 @@ export async function initEmploymentOffice() {
const list = await prisma.province.findMany(); const list = await prisma.province.findMany();
await prisma.$transaction(async (tx) => { await prisma.$transaction(
async (tx) => {
await Promise.all( await Promise.all(
list list
.map(async (province) => { .map(async (province) => {
@ -230,7 +236,11 @@ export async function initEmploymentOffice() {
}) })
.flat(), .flat(),
); );
}); },
{
timeout: 15_000,
},
);
console.log("[INFO]: Sync employment office, OK."); console.log("[INFO]: Sync employment office, OK.");
} }