Skip to content

Instantly share code, notes, and snippets.

@pchiusano
Created November 11, 2013 17:06
Show Gist options
  • Save pchiusano/7416609 to your computer and use it in GitHub Desktop.
Save pchiusano/7416609 to your computer and use it in GitHub Desktop.
Worst case scenario for `Nondeterminism[Future]`.
// This bombs with a SOE
object Main extends App {
val F = Nondeterminism[Future]
val N = 10000
val worstCaseScenario =
(0 until N).foldLeft(Future { Thread.sleep(50000) })((a,b) =>
F.both(a, F.point(b)).map(_._1)
)
worstCaseScenario.run
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment