Increase product import batch size

This commit is contained in:
2025-01-29 18:51:55 -05:00
parent 0d377466aa
commit 2b329a55a4
2 changed files with 3 additions and 3 deletions

View File

@@ -10,8 +10,8 @@ const importPurchaseOrders = require('./import/purchase-orders');
dotenv.config({ path: path.join(__dirname, "../.env") }); dotenv.config({ path: path.join(__dirname, "../.env") });
// Constants to control which imports run // Constants to control which imports run
const IMPORT_CATEGORIES = false; const IMPORT_CATEGORIES = true;
const IMPORT_PRODUCTS = false; const IMPORT_PRODUCTS = true;
const IMPORT_ORDERS = true; const IMPORT_ORDERS = true;
const IMPORT_PURCHASE_ORDERS = true; const IMPORT_PURCHASE_ORDERS = true;

View File

@@ -376,7 +376,7 @@ async function importProducts(prodConnection, localConnection) {
await localConnection.query("DROP TEMPORARY TABLE IF EXISTS temp_prod_data"); await localConnection.query("DROP TEMPORARY TABLE IF EXISTS temp_prod_data");
// Process products in batches // Process products in batches
const BATCH_SIZE = 1000; const BATCH_SIZE = 10000;
let processed = 0; let processed = 0;
for (let i = 0; i < rows.length; i += BATCH_SIZE) { for (let i = 0; i < rows.length; i += BATCH_SIZE) {
const batch = rows.slice(i, i + BATCH_SIZE); const batch = rows.slice(i, i + BATCH_SIZE);