-
Notifications
You must be signed in to change notification settings - Fork 153
feat(batch): sequential async processing of records for BatchProcessor
#3109
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
feat(batch): sequential async processing of records for BatchProcessor
#3109
Conversation
If the the option is set to true, process parallel otherwise process sequentially
…rocessor Although it would be better if we could omit this from sync processors too. But at this moment typescript can not differentiate between `BatchProcessor` & `BatchProcessorSync`
Hi @arnabrahman, thank you for the PR! I will start reviewing it tomorrow morning - I was on PTO for the first half of the week. Regarding the SonarCloud findings, I think we can simplify the structure of the tests and remove the findings by just changing it to something like: describe('Asynchronously processing', () => {
const cases = [
{
description: 'in parallel',
options: { processInParallel: true },
},
{
description: 'sequentially',
options: { processInParallel: false },
},
];
it.each(cases)('SQS Records $description', ({ options }) => {
})
}) or similar |
@dreamorosi No worries, i will take a look at this tomorrow. |
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.
Amazing work on this PR @arnabrahman, appreciate your help!
Thank you also for updating the docs with the new feature 🎉
|
Summary
By default, the
BatchProcessor
processes records in parallel usingPromise.all()
. We want to give users an option to process records sequentially.Changes
processInParallel
, which indicates whether records should be processed in parallel or sequentially.BatchProcessor
class but I couldn't make the optional property work as the class signature is similar for bothBatchProcessor
&BatchProcessorSync
. I have omitted this property forSqsFifoPartialProcessor
though.processInParallel
option. IfprocessInParallel
is not provided, the records will default to being processed in parallel. Made the changes in theBasePartialProcessor
class.describe.each()
. My rationale is that every feature forBatchProcessor
should behave the same, regardless of whether records are processed in parallel or sequentially. This approach also avoids duplicating test cases for both options.processInParallel
and made additional changes where necessary, using my judgment.Issue number: #1829
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.