Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: batched evaluate action params to a chunk size #36482

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/client/src/sagas/ActionExecution/PluginActionSaga.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
all,
call,
delay,
put,
select,
take,
Expand Down Expand Up @@ -441,7 +442,11 @@ function* evaluateActionParams(
const arrDatatype: Array<string> = [];

// array of objects containing blob urls that is loops and individual object is checked for resolution of blob urls.
for (const val of value) {

const BATCH_CHUNK_SIZE = 100;

for (let j = 0; j < value.length; j++) {
const val = value[j];
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const newVal: Record<string, any> = yield call(
Expand Down Expand Up @@ -474,6 +479,11 @@ function* evaluateActionParams(
filePickerInstrumentation["fileSizes"].push(size);
filePickerInstrumentation["fileTypes"].push(type);
}

if ((j + 1) % BATCH_CHUNK_SIZE === 0) {
// Yield control back to the event loop and empty the stack trace
yield delay(0);
}
}

//Adding array datatype along with the datatype of first element of the array
Expand Down
Loading