Skip to content

Instantly share code, notes, and snippets.

@brikis98
Created May 3, 2014 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brikis98/581bec202b0a622d3c15 to your computer and use it in GitHub Desktop.
Save brikis98/581bec202b0a622d3c15 to your computer and use it in GitHub Desktop.
def asyncResult = {
//#async-result
import play.api.libs.concurrent.Execution.Implicits.defaultContext
def index = Action.async {
val futureInt = scala.concurrent.Future { intensiveComputation() }
futureInt.map(i => Ok("Got result: " + i))
}
//#async-result
index
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment