hannesstruss
06/17/2018, 5:45 PMrx.Observable.switchMap for Channels: https://gist.github.com/hannesstruss/927ec8120d7cb312d80685f230d50c6e
It's kind of working ("just" deadlocking occasionally), but I found the way there to be very brittle, so much depends on using the right coroutine contexts in the right places. E.g. when not using Unconfined for produce in the transform function, the wrong channel will be selected in whileSelect and the outcome will be wrong.
Any general hints on how to approach problems like that?hannesstruss
06/17/2018, 8:27 PMTestCoroutineContext helped to kill some deadlocks in the tests, sadly at a cost, since the `delay`s now actually take time.
Feedback still welcome, I still don't really have an idea what I'm doing 🤔Vsevolod Tolstopyatov [JB]
06/18/2018, 3:40 PMswitchMap is non-trivial one.
You should also cancel current when receiving new event from input and propagate cancellation to downstream from input.Vsevolod Tolstopyatov [JB]
06/18/2018, 3:47 PMUnconfined is recommended to use only for map/filter ops, not for coroutines: it’s very fragile “advanced” API