Why is asyncFilter calling asyncBatch
See original GitHub issueThe call to asyncBatch
seems to be there in order to provide concurrency, but batch does not provide any concurrency, it just delays the emission of results until more results are ready. This sucks! If you try to consume only a single result from asyncFilter
with a concurrency higher than 1, it will never return! It’ll just sit there waiting for more items to put in its batch! Why would we sacrifice the correctness of the implementation for a perf optimization that we don’t even know we need, and clearly don’t know how to properly test?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Call async/await functions in parallel - Stack Overflow
Original answer: This answer is much more clear than Haven's. It's clear that the function calls will return promise objects, and await will...
Read more >Deeply Understanding JavaScript Async and Await with ...
An async function always returns a promise. The function fn returns 'hello' . Because we have used async , the return value 'hello'...
Read more >Async and Batch Requests - Marketing API
The status param is used to filter requests by its own status and can be any combination ... You can make an async...
Read more >How to use async functions with Array.filter in Javascript
While an async filter is possible, it works in a way that looks strange at first. And while concurrency controls are still available,...
Read more >Vue Data Grid: Client-Side Data - High Frequency Updates
The default wait between executing batches is 50ms. This means when an Async Transaction is provided to the grid, it can take up...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have an even better approach that is almost ready to go which should actually be optimal and correct in every case.
I like this approach. you could leverage Promise.race, when the buffer is full.
In my use case I had a stream of ids and I need to retrieve data from a rest endpoint for every id. So calling these endpoints in parallel gave a great perf boost. (I am talking about asyncMap, but asyncFilter behaves the same)