Marcus Ilgner
02/17/2025, 8:39 AMproduce can lose elements, I wonder whether Flow::produceIn has the same potential issue? Does anyone know? I want to use select to pull elements out of a flow but without the chance of losing any... (i.e. if that SelectClause gets cancelled, it should just receive that element on the next attempt).Jakub Zalas
02/17/2025, 1:01 PMproduce might lose elements?Marcus Ilgner
02/17/2025, 1:06 PMreceive suspend function. There's a block titled "Undelivered elements" in the documentation here: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/produce.htmlEmil Kantis
02/19/2025, 8:47 AMMarcus Ilgner
02/21/2025, 12:18 PMonUndeliveredElement callback that somehow handles the element. How I understand it to work, it's like this: the onReceive SelectClause waits for elements to appear in the flow. Once that happens, they are (a) collected and (b) sent to the channel. But if the select statement happens to succeed on another SelectClause after (a) and before (b), the onReceive clause would be cancelled and the element could become lost.