Last active
November 23, 2016 16:18
-
-
Save javipacheco/61e151e5a203c04ee9813c0c1c35166b to your computer and use it in GitHub Desktop.
Issue with SerialCancelable in Monix 2.1.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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