http - 1 秒后未订阅 Akka HTTP 错误响应实体
问题描述
我正在使用 Akka HTTP cachedHostConnectionPoolHttps 池作为 Akka Streams Flow 的一部分发送请求:
private val requestFlow: Flow[(HttpRequest, HelperClass), Either[Error, String], _] =
Http().cachedHostConnectionPoolHttps(BaseUrl).mapAsync(1) {
case (Success(HttpResponse(_, _, entity, _)), _) =>
Unmarshal(entity).to[String].map(response => {
Right(response)
})
case (Failure(ex), _) =>
Future(Left(Error(ex)))
}
由于某种原因,并非所有请求响应都在处理中。一些导致错误的结果:
a.h.i.e.c.PoolGateway - [0 (WaitingForResponseEntitySubscription)] Response entity was not subscribed after 1 second. Make sure to read the response entity body or call `discardBytes()` on it.
如何在保持上述流程的同时订阅我的回复?
解决方案
虽然这不是最好的解决方案,但您可以像这样增加响应订阅超时:
akka.http.host-connection-pool.response-entity-subscription-timeout = 10.seconds
推荐阅读
- python - 使用变量调用另一个pythonfile中的数据框
- javascript - 从嵌套对象收集子值并分配给父属性
- c++ - 为什么对象的静态初始化肯定为零?
- c - 如何检测连接的 Unix 域数据报套接字已关闭
- ios - Swift中的多个变量等于相同的值
- java - 克鲁什卡尔算法。我的代码有什么问题?
- python - 如何通过逐行求和(SQL Alchemy)来创建布尔掩码?
- mongodb - 使用 /data/db 目录文件创建新的 mong db
- python - 如何将前一个单元格的输出导出到 csv 文件?
- flutter - 有没有类似于 SwiftUI 的 Disclosure Group 的小部件?