I'm confused about Conflated channel ... I have th...
# coroutines
p
I'm confused about Conflated channel ... I have the following code
Copy code
runBlocking {
        val channel = produce(capacity = Channel.CONFLATED) {
          (0..3).forEach {
            println("Send $it")
            send(it)
            delay(100)
          }
        }
        channel.consumeEach {
          println("Consume $it")
          delay(500)
        }
      }
and the result is
Copy code
Send 0
Consume 0
Send 1
Send 2
Send 3
I expected 3 to be consumed as well as it's the last value pushed into the channel but I can't figure out why it's note getting consumed. Any help ? Thanks