Merge pull request #1899 from gramk/wip-log-ask-timeout

=act #3800: Add timeout value in AskTimeoutException message.
This commit is contained in:
Roland Kuhn 2014-01-14 00:42:17 -08:00
commit eb6c2eee07
2 changed files with 9 additions and 1 deletions

View file

@ -76,6 +76,14 @@ class AskSpec extends AkkaSpec {
}.getMessage.contains("/user/silent") should be(true)
}
"include timeout information in AskTimeout" in {
implicit val timeout = Timeout(0.5 seconds)
val f = system.actorOf(Props.empty) ? "noreply"
intercept[AskTimeoutException] {
Await.result(f, remaining)
}.getMessage should include(timeout.duration.toMillis.toString)
}
"work for ActorSelection" in {
implicit val timeout = Timeout(5 seconds)
import system.dispatcher

View file

@ -330,7 +330,7 @@ private[akka] object PromiseActorRef {
val a = new PromiseActorRef(provider, result)
implicit val ec = a.internalCallingThreadExecutionContext
val f = scheduler.scheduleOnce(timeout.duration) {
result tryComplete Failure(new AskTimeoutException(s"Ask timed out on [$targetName]"))
result tryComplete Failure(new AskTimeoutException(s"Ask timed out on [$targetName] after [${timeout.duration.toMillis} ms]"))
}
result.future onComplete { _ try a.stop() finally f.cancel() }
a