limit batchInsert meta on sqlite

This commit is contained in:
Fendy Heryanto
2026-01-29 13:28:16 +07:00
parent b60f5187e2
commit 9effc3642d

View File

@@ -314,7 +314,15 @@ export class MetaService {
};
insertObj.push(tempObj);
}
await this.knexConnection.batchInsert(target, insertObj);
const BATCH_SIZE =
this.knexConnection.client.config.client === 'sqlite3' ? 200 : 10000;
for (let i = 0; i < insertObj.length; i += BATCH_SIZE) {
await this.knexConnection.batchInsert(
target,
insertObj.slice(i, i + BATCH_SIZE),
);
}
return insertObj;
}