Fixed batchExecutor to not be useless #346
Open
+24
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Promise.all()
doesn't trigger the promises to start their work, creating the promise itself does. Reference:https://stackoverflow.com/a/40639551
Currently, all
batchExecutor
does is waiting for the promises in chunks, but they're still all executed in parallel. This pull request changes the code so that instead of (already running) promises, promise generator functions are passed, so that the promises are created (and actually executed) in chunks.Another unfixed issue is that
batchExecutor
is used recursively, so if the batch limit is, say, 50, and the tree depth is 3, the limit is actually50^3=125000
since eachbatchExecutor
instance manages its own limit.