Show HN: Coseq – high order functions for JavaScript async/sync iterators
github.com
github.com
Definitely something I have been pondering and to consider when dealing with async iterators that interact with data providers with no back pressure handling built in.
This is one of the outstanding issues with promises too. That there is no standard way to cancel them. I hope TC39 are considering this as part of the spec.
It's less of an issue in the client, because you are less likely to encounter big firehoses of data. But I have had the issue with webrtc data processing, and some flow control / back pressure mechanisms would be awesome. We were able to just use node streams, but would be nice if there was an elegant solution for async iterators too. Node streams are good, but also add a lot of complexity.
And debugging back-pressure issues can be very tricky in my experience, as they can manifest themselves in a variety of different ways.