Skip to content

Asynchronous Iterables

Vitaly Tomilov edited this page Dec 8, 2021 · 40 revisions

Asynchronous iterables are fully supported by the library, with some considerations, as below.

The library enforces consistency of the pipeline result with the source iterable type:

  • When the source iterable is synchronous, the end result is also synchronous
  • When the source iterable is asynchronous, the end result is also asynchronous

Some operators (concat, defaultEmpty, aggregate) make it possible to violate the first item, because they either accept both synchronous and asynchronous iterables, or can return such. When the source iterable of the pipeline is synchronous, and you inject asynchronous iterables (by mistake), the pipeline result will still be cast as synchronous, while the asynchronous iterables will be processed as simple values, and not as iterables.

Note that the opposite isn't true, i.e. when the source iterable is asynchronous, you can inject both synchronous and asynchronous iterables, and all will be processed correctly, because addition of synchronous iterables to an asynchronous pipeline doesn't change anything, they will work fine alongside asynchronous iterables.

Just something to keep an eye on ;)

Clone this wiki locally