Browse Source

fix: bulk update small chunks

pull/8315/head
mertmit 7 months ago
parent
commit
0869ba4618
  1. 4
      packages/nocodb/src/db/BaseModelSqlv2.ts

4
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -3711,7 +3711,7 @@ class BaseModelSqlv2 {
const toBeUpdated = []; const toBeUpdated = [];
const toRead = []; const toRead = [];
const readChunkSize = 100; const readChunkSize = 100;
for (const d of updateDatas) { for (const [i, d] of updateDatas.entries()) {
const pkValues = this._extractPksValues(d); const pkValues = this._extractPksValues(d);
if (!pkValues) { if (!pkValues) {
// throw or skip if no pk provided // throw or skip if no pk provided
@ -3725,7 +3725,7 @@ class BaseModelSqlv2 {
toRead.push(pkValues); toRead.push(pkValues);
if (toRead.length >= readChunkSize) { if (toRead.length >= readChunkSize || i === updateDatas.length - 1) {
const tempToRead = toRead.splice(0, toRead.length); const tempToRead = toRead.splice(0, toRead.length);
const oldRecords = await this.list( const oldRecords = await this.list(
{ {

Loading…
Cancel
Save