akka http配置中的空闲超时和请求超时有什么区别?

Ati*_*tiq 6 scala connection-timeout akka-http

我去了文档,发现了这些#空闲连接将自动关闭的时间。# 设置为infinite完全禁用空闲连接超时。空闲超时 = 10 秒

# Defines the default time period within which the application has to
# produce an HttpResponse for any given HttpRequest it received.
# The timeout begins to run when the *end* of the request has been
# received, so even potentially long uploads can have a short timeout.
# Set to `infinite` to completely disable request timeout checking.
#
# If this setting is not `infinite` the HTTP server layer attaches a
# `Timeout-Access` header to the request, which enables programmatic
# customization of the timeout period and timeout response for each
# request individually.
request-timeout = 20 s
Run Code Online (Sandbox Code Playgroud)

我有一个场景,我的服务器需要超过 10 秒来处理响应,但在发送 HTTPResponse 之前,客户端和服务器之间的 TCP 连接由于空闲超时而超时

虽然此时连接处于空闲状态,但请求仍在处理中。

我以为这是响应超时的责任?

在这种情况下,任何人都可以向我解释空闲超时和响应超时之间的区别吗?

use*_*321 2

文档更多详细信息这里

  # The idle timeout for an open connection after which it will be closed
  # Set to null or "infinite" to disable the timeout, but notice that this
  # is not encouraged since timeout are important mechanisms to protect your
  # servers from malicious attacks or programming mistakes.
  idleTimeout = 75 seconds
Run Code Online (Sandbox Code Playgroud)

如果看起来您设置的空闲超时低于请求超时,那么它优先。您的空闲超时设置应该比请求超时长,因此对于每个请求,请求超时决定何时关闭连接。