π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix: proper batch logic
mertmite2dc1c2b0f16
diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.tsindex 2543eefb61..4319bf60f8 100644--- a/packages/nocodb/src/db/BaseModelSqlv2.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts@@ -5671,9 +5671,9 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {}}- const batchSize = 50;- const promises = [];+ const batchSize = 15;+ // Process attachments in batchesfor (let i = 0; i < allAttachments.length; i += batchSize) {const batch = allAttachments.slice(i, i + batchSize);const batchPromises = batch.map(@@ -5683,7 +5683,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {filename: attachment.title,}).catch(() => {}), // Ignore individual failures);- promises.push(...batchPromises);+ await Promise.all(batchPromises);}// Process thumbnails in batches@@ -5703,11 +5703,8 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {nestedKeys: ['thumbnails', thumbnailKey],}).catch(() => {}), // Ignore individual failures);- promises.push(...batchPromises);+ await Promise.all(batchPromises);}-- // Wait for all batches to complete- await Promise.all(promises);} catch (error) {// Log error but don't throw to avoid breaking the entire responseconsole.warn('Error in _convertAttachmentType:', error.message);