``` fun runJob() = launch(IO) { if (isActi...
# coroutines
d
Copy code
fun runJob() = launch(IO) {
      if (isActive) doStuff()
      if (isActive) doOtherStuff()
      if (isActive) doEvenMoreStuff()
    }
  
val channel = Channel(Channel.Conflated)
var currJob: Job? = null

channel.consumeEach { currJob?.cancel(); currJob = runJob() }

// Send new job
channel.offer(Unit)
What about this (im not on my computer, so excuse if any mistakes.. its the idea though...) @Paul Woitaschek