public enum TickerMode
Mode for TickerChannelsKt.ticker
function.
Note: Ticker channels are not currently integrated with structured concurrency and their api will change in the future.
TickerChannelsKt.ticker
Enum Constant and Description |
---|
FIXED_DELAY
Maintains fixed delay between produced elements if consumer cannot keep up or it otherwise slow.
|
FIXED_PERIOD
Adjust delay to maintain fixed period if consumer cannot keep up or is otherwise slow.
This is a default mode.
|
public static TickerMode FIXED_PERIOD
Adjust delay to maintain fixed period if consumer cannot keep up or is otherwise slow. This is a default mode.
val channel = ticker(delay = 100)
delay(350) // 250 ms late
println(channel.poll()) // prints Unit
println(channel.poll()) // prints null
delay(50)
println(channel.poll()) // prints Unit, delay was adjusted
delay(50)
println(channel.poll()) // prints null, we'are not late relatively to previous element
public static TickerMode FIXED_DELAY
Maintains fixed delay between produced elements if consumer cannot keep up or it otherwise slow.