Josh Skeen
01/08/2024, 3:43 PMprivate val _mySharedFlow = MutableSharedFlow<SomeEvent>(
extraBufferCapacity = 10,
onBufferOverflow = SUSPEND,
)
We often run into debate in code review about choosing the correct value for extraBufferCapacity when MSF is used with tryEmit, the thought being “we could lead to a large amount of memory usage with some high volume of events that havent been collected yet”. The question we have is what is the best way to choose
this value or should we consider an alternate approach? It seems arbitrary to us to have to pick a number out of thin air - do you recommend calling tryEmit and using whether it returns false and logging in this case (according to the docs , this only occurs with SUSPEND of onBufferOverflow, correct?) or some other way of choosing - or is this concern misguided?darkmoon_uk
01/10/2024, 7:21 AMJosh Skeen
01/10/2024, 12:48 PM