是否可以在Finatra服务器中设置HTTP请求响应超时?
http控制器回调通常返回一个未来,一旦解析,响应将被传输。我想在Finatra中定义服务器在返回500或400响应之前应该等待多长时间。
发布于 2020-01-24 07:08:34
您可以扩展HttpServer并定义自己的超时。
trait CustomServer extends HttpServer with Tls {然后覆盖configureHttpServer方法,并定义超时、请求站点和其他属性。
override def configureHttpServer(server: Http.Server): Http.Server = {
server.withAdmissionControl.concurrencyLimit(maxConcurrentRequests = 2000, maxWaiters = 0)
.withResponseClassifier(HttpResponseClassifier.ServerErrorsAsFailures)
.withMaxRequestSize(StorageUnit.fromMegabytes(200))
.withRequestTimeout(50.seconds)
}发布于 2020-01-22 13:57:21
我想,你是在找Future.within
https://stackoverflow.com/questions/59860180
复制相似问题