slenz
slenz

Reputation: 53

How to change future timeout with play framework 2.1.0

i'm calling a webservice using play framework 2.1 which takes longer than 10s. because of that i always receive the following error:

play.api.Application$$anon$1: Execution exception[[TimeoutException: Futures timed out after [10000 milliseconds]]]
    at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.0]
    at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.0]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:132) [play_2.10.jar:2.1.0]
    at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:128) [play_2.10.jar:2.1.0]
    at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
    at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.0]
java.util.concurrent.TimeoutException: Futures timed out after [10000 milliseconds]
    at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:96) ~[scala-library.jar:na]
    at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:58) ~[scala-library.jar:na]
    at scala.concurrent.Await$$anonfun$ready$1.apply(package.scala:86) ~[scala-library.jar:na]
    at scala.concurrent.Await$$anonfun$ready$1.apply(package.scala:86) ~[scala-library.jar:na]

how can i increase the timeout value?

i tried to change the values of:

promise.akka.actor.typed.timeout
play.akka.actor.typed.timeout

but without success...

Thanks in advance for the help

Upvotes: 5

Views: 8836

Answers (3)

abbas
abbas

Reputation: 7071

If you are writing unit tests this is how you would do it.

@Test
public void testInServer() {
    running(testServer(3333), new Runnable() {
        public void run() {
            assertThat(
                WS.url("http://localhost:3333").get().get(timeout).getStatus()
            ).isEqualTo(OK);
        }
    });
}

Upvotes: 0

Shawn Vader
Shawn Vader

Reputation: 12385

It looks like its been fixed in 2.3 but they are not going to back port to any of the 2.2 builds

    javaOptions in Test += "-Dtest.timeout=10000"

Since I am using 2.2 this does not work for me but I hope it works for those on 2.3

Upvotes: 2

mguillermin
mguillermin

Reputation: 4181

Unfortunately, it is hard-coded in the framework... See https://github.com/playframework/Play20/blob/master/framework/src/play/src/main/scala/play/api/libs/concurrent/Promise.scala#L266

It seems that an issue is already opened about that : https://github.com/playframework/Play20/issues/1002

Upvotes: 2

Related Questions