Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 298
slenz Avatar asked Oct 04 '22 03:10

slenz


2 Answers

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

like image 64
mguillermin Avatar answered Oct 10 '22 03:10

mguillermin


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

like image 31
Shawn Vader Avatar answered Oct 10 '22 02:10

Shawn Vader