本文介绍了如何使用play framework 2.1.0更改将来的超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用播放框架2.1调用web服务,这需要超过10秒。因为我总是收到以下错误:

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]

如何增加超时值?

我试图更改以下值:

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


但没有成功......

but without success...

提前感谢您的帮助

推荐答案

不幸的是,它在框架中是硬编码的...参见

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

这篇关于如何使用play framework 2.1.0更改将来的超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 14:16