-
Notifications
You must be signed in to change notification settings - Fork 10
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
salesforce
Add support for asyncMode
in bulk operation
#907
base: main
Are you sure you want to change the base?
Conversation
salesforce
Add support for asyncMode
in bulk operation
if (asyncMode) { | ||
return batch.on('queue', async function (batchInfo) { | ||
console.info('Batch queued. Batch ID:', batchInfo.id); | ||
resolve({ batchInfo }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A promise can only resolve once. If there are multiple queue events, for multiple chunks, then they'll never report back to user code. In other words, we'll only ever report back the first batch here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I have tried running the test with a batch size of 1 and i got the expected results.
Can you tell me more about this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested multiple batches by reducing the batch size to 1 and run integration test that insert two records with the option asynMode: true
, I can see that i am getting two batches records after the bulk operation is done.
Summary
Add
asyncMode
option in bulk operation. If you don't provided this extraasyncMode
option, we return all record info tostate.data
as we currently do.Fixes #286
Details
asyncMode
istrue
we returnbatchInfo
{ success: true, batches: [], errors: []}
ifasyncMode: true
state.data.batches
asyncMode: true
AI Usage
Please disclose how you've used AI in this work (it's cool, we just want to know!):
You can read more details in our Responsible AI Policy
Review Checklist
Before merging, the reviewer should check the following items:
dev only changes don't need a changeset.