Skip to content

Instantly share code, notes, and snippets.

@javipacheco
Last active November 23, 2016 16:18
Show Gist options
  • Save javipacheco/61e151e5a203c04ee9813c0c1c35166b to your computer and use it in GitHub Desktop.
Save javipacheco/61e151e5a203c04ee9813c0c1c35166b to your computer and use it in GitHub Desktop.
Issue with SerialCancelable in Monix 2.1.1
import monix.eval.Task
import monix.execution.Scheduler.Implicits.global
import monix.execution.cancelables.SerialCancelable
val ref = SerialCancelable()
val t1 = Task {
Thread.sleep(10000)
println("Task 1")
}
val t2 = Task {
println("Task 2")
}
val combineTask = for {
_ <- t1
_ <- t2
} yield ()
val t3 = Task {
println("Task 3")
}
ref := combineTask.runAsync
ref := t3.runAsync
// Monix 2.0.0
//
// > Task3
// > Task1
// Monix 2.1.1
//
// > Task3
// > Task1
// > Task2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment