You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all! We encountered this issue when using flat_map operator, as defined in documentation flat_map internally merges emisions of the CollectionSelector function. When using range in said function the output is as expected:
Is this the expected behavior? Or there is somenthing we are missing?
We need to perform the flat_map operation using create with the emissions not serialized. If someone could give us a hand to workaround this, we will be very grateful.
Thanks in advance! 😃
The text was updated successfully, but these errors were encountered:
Looks like it is because range observable uses scheduling under-hood via identity_current_thread instead of identity_immediate
template<classT>
staticautorange(T first = 0, T last = std::numeric_limits<T>::max(), std::ptrdiff_t step = 1)
-> decltype(rxs::range<T>(first, last, step, identity_current_thread())) {
return rxs::range<T>(first, last, step, identity_current_thread());
}
I've expected, that second output should be "canonical", due to flat_map just subscribes on observable. In your cases both of observables are synchronized (i mean, no direct usage of threads and etc), so, subscribe should wait till on_completed. By this reason second result is correct. To have "non-serialized" output for second scenario you need to provide some scheduling manually.
@kirkshoop , what is reason to use current_thread instead of immediate for range observable?
current_thread is used so that multiple ranges interleave values even on a single thread. Not interleaving values can create infinite allocations inside some operators (zip is one culprit).
The create usage here is blocking in the subscribe function until the for loop completes. To get interleaving a loop cannot be used in create. Instead there must be some state and a function scheduled that sends one value and updates the state and reschedules itself.
Hi all! We encountered this issue when using flat_map operator, as defined in documentation flat_map internally merges emisions of the CollectionSelector function. When using range in said function the output is as expected:
Output:
But when using the create function all outputs are seralized for each source observable:
Output:
Is this the expected behavior? Or there is somenthing we are missing?
We need to perform the flat_map operation using create with the emissions not serialized. If someone could give us a hand to workaround this, we will be very grateful.
Thanks in advance! 😃
The text was updated successfully, but these errors were encountered: