我想在喷涂应用程序中更改超时,但实现此目的的最简单方法是什么?我在github上看到了一些例子,但它们相当复杂。
感谢。
我试过了:
class MyServiceActor extends Actor with MyService {
sender ! SetRequestTimeout(scala.concurrent.duration.Duration(120,"second"))
sender ! spray.io.ConnectionTimeouts.SetIdleTimeout(scala.concurrent.duration.Duration(120,"second"))
// the HttpService trait defines only one abstract member, which
// connects the services environment to the enclosing actor or test
def actorRefFactory = context
// this actor only runs our route, but you could add
// other things here, like request stream processing
// or timeout handling
def receive = runRoute( myRoute )
}
但超时似乎保持在~5秒。
答案 0 :(得分:1)
您应该能够使用底层喷雾罐服务器的超时配置值来配置超时
spray.can.server {
request-timeout = 2s
}