groostav
09/16/2019, 6:57 PMjava.util.concurrent
or similar to give me this?withoutclass
09/16/2019, 7:00 PMChannel.CONFLATED creates a ConflatedChannel which always buffers the most recent item sent to the channel and emits this to the receiver. This way, the receiver always get the most recently sent item.
groostav
09/16/2019, 7:05 PMreline
09/16/2019, 7:55 PM/**
* Creates a channel with the specified buffer capacity (or without a buffer by default).
* See [Channel] interface documentation for details.
*
* @param capacity either a positive channel capacity or one of the constants defined in [Channel.Factory].
* @throws IllegalArgumentException when [capacity] < -2
*/
public fun <E> Channel(capacity: Int = RENDEZVOUS): Channel<E> =
when (capacity) {
RENDEZVOUS -> RendezvousChannel()
UNLIMITED -> LinkedListChannel()
CONFLATED -> ConflatedChannel()
BUFFERED -> ArrayChannel(CHANNEL_DEFAULT_CAPACITY)
else -> ArrayChannel(capacity)
}
reline
09/16/2019, 7:57 PMbdawg.io
09/16/2019, 8:23 PMwithoutclass
09/16/2019, 8:27 PMwithoutclass
09/16/2019, 8:27 PMreline
09/16/2019, 8:37 PMscan
operator to add to the queue. Use map
to hand off the most recent item to your consumer, or give the entire list to your consumer to take the most recent item.bdawg.io
09/17/2019, 4:37 AMscan
could work. Especially if the buffer ends up being fairly small (a few dozen items). Here's my swing at it
https://pl.kotl.in/aDbwuPubFbdawg.io
09/17/2019, 4:44 AMbdawg.io
09/17/2019, 4:05 PMgroostav
09/22/2019, 10:08 PMFlow
.