Sam Stone
04/24/2022, 5:21 PMflow2
being called in flow1.map{ flow2(it) }.flattenConcat()
?
flow1
is a MutableStateFlow<MutableSet<Int>>
of db entity IDs, flow2
is a Flow of lists of entities, which is updated when any of the flow's entities' properties change. I am updating the properties and then calling flow1.emit(set)
, but only flow2.onEach
is being called, not flow1.map{}
. Any suggestions?julian
04/24/2022, 5:31 PMflow2.onEach
, but it's not clear how this is being used by flow1.map{ flow2(it) }.flattenConcat()
.
Can you provide a more detailed/complete code sample?Sam Stone
04/24/2022, 5:43 PMonEach
is just for logging purposes.julian
04/24/2022, 6:09 PMflow2.onEach
is called, then flow1.map
must have been called at least once. Are you saying that you don't see execution of flow1.map
when you call flow1.emit
after the first time? If so, is it possible that flow2
is exerting backpressure? If so, this from the MutableStateFlow docs may be relevant:
Updates to the value are always conflated. So a slow collector skips fast updates, but always collects the most recently emitted value.
This would cause `emit`s to be ignored, and map
would not execute for those dropped values.wasyl
04/24/2022, 7:04 PM