1
0
Fork 0
mirror of synced 2024-09-08 21:51:58 +12:00
This commit is contained in:
Adria Navarro 2023-12-21 18:29:57 +01:00
parent 92f1107e6c
commit 494a2ff91f

View file

@ -17,6 +17,7 @@ const start = Date.now()
async function batchCreate(apiKey, appId, table, items, batchSize = 100) { async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
let i = 0 let i = 0
let errors = 0
async function createSingleRow(item) { async function createSingleRow(item) {
try { try {
const row = await createRow(apiKey, appId, table, item) const row = await createRow(apiKey, appId, table, item)
@ -27,7 +28,7 @@ async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
) )
return row return row
} catch { } catch {
console.error("Error creating row", item) errors++
} }
} }
@ -37,6 +38,9 @@ async function batchCreate(apiKey, appId, table, items, batchSize = 100) {
const batchRows = await Promise.all(batchPromises) const batchRows = await Promise.all(batchPromises)
rows.push(...batchRows) rows.push(...batchRows)
} }
if (errors) {
console.error(`Error creating ${errors} row`)
}
return rows return rows
} }