title: Scala Akka Play, Future doesn't return
body: <p>I'm using Scala 2.10, Akka 2.1 and Play 2.1. When I send an http request to my backend, I <code>ask</code> one actor to compute something. The idea is to return the result of the calculation if it returns before a timeout, otherwise a different string. See code below.</p>
  
  <pre><code>val futureInt: Future[Int] = ask(testActor, Calculate(number.toInt)).mapTo[Int]
  val timeoutFuture = play.api.libs.concurrent.Promise.timeout("Oops", 2.seconds)
  
  Async {
    Future.firstCompletedOf(Seq(futureInt, timeoutFuture)).map {
      case i: Int =&gt; Ok("Got result " + i)
      case t: String =&gt; Ok("timeout expired")
    }
  }
  </code></pre>
  
  <p>The actor is as follows:</p>
  
  <pre><code>class TestActor() extends Actor {
    def receive = {
      case Calculate(tonumber: Int) =&gt;
        for (a &lt;- 1 to tonumber) {
          val c: Double = scala.math.pow(a, 2)
          println("a: " + a + ", c: " + c)
        }
        12345 // hardcoded value to return when the calculation finishes
      case _ =&gt;
        println("bah")
    }
  }
  </code></pre>
  
  <p>My problem is that even if the actor finishes before the timeout, nothing is "returned" by the Future and so the timeout always expires. What am I doing wrong? Thanks a lot.</p>