0
A
回答
1
服務器超時
BlazeBuilder可以很容易地進行調整。默認實現是
import org.http4s._
import scala.concurrent.duration._
BlazeBuilder(
socketAddress = InetSocketAddress.createUnresolved(LoopbackAddress, 8080),
serviceExecutor = DefaultPool, // @org.http4s.util.threads - ExecutorService
idleTimeout = 30.seconds
isNio2 = false,
connectorPoolSize = math.max(4, Runtime.getRuntime.availableProcessors() + 1),
bufferSize = 64*1024,
enableWebSockets = true,
sslBits = None,
isHttp2Enabled = false,
maxRequestLineLen = 4*1024,
maxHeadersLen = 40*1024,
serviceMounts = Vector.empty
)
我們可以利用默認值並更改該值,因爲該類具有實現的複製方法。
import org.http4s._
import scala.concurrent.duration._
BlazeBuilder.copy(idleTimeout = 5.minutes)
然後,您可以繼續使用您的服務器,然而,您可以隨意添加服務,然後再投放服務。
客戶端超時
BlazeClient採取稱爲配置類BlazeClientConfig
默認爲
import org.http4s._
import org.http4s.client._
BlazeClientConfig(
idleTimeout = 60.seconds,
requestTimeout = Duration.Inf,
userAgent = Some(
`User-Agent`(AgentProduct("http4s-blaze", Some(BuildInfo.version)))
),
sslContext = None,
checkEndpointIdentification = true,
maxResponseLineSize = 4*1024,
maxHeaderLength = 40*1024,
maxChunkSize = Integer.MAX_VALUE,
lenientParser = false,
bufferSize = 8*1024,
customeExecutor = None,
group = None
)
但是我們有一個默認的配置和它存在的情況下類,你大概會更好地修改默認值。在大多數情況下使用PooledHttp1Client。
import scala.concurrent.duration._
import org.http4s.client._
val longTimeoutConfig =
BlazeClientConfig
.defaultConfig
.copy(idleTimeout = 5.minutes)
val client = PooledHttp1Client(
maxTotalConnections = 10,
config = longTimeoutConfig
)
相關問題
- 1. 如何增加請求超時?
- 2. 如何增加nginx請求超時?
- 3. 請求超時增加超過30秒?
- 4. 增加LBAPI請求的超時
- 5. 如何增加Web服務請求的超時時間?
- 6. 在ExtJs中增加Ajax請求超時
- 7. WildFly增大請求超時
- 8. 如何增加IIS中的請求超時?
- 9. 如何增加特定腳本的請求超時php fpm
- 10. 如何增加Azure應用服務230秒請求超時
- 11. Ajax請求在10分鐘後超時,如何增加它
- 12. 如何增加空中客戶端http請求超時?
- 13. 如何使URL加載請求超時?
- 14. 如何添加請求超時異常
- 15. 是否可以增加Google Cloud Datastore請求的超時時間?
- 16. 請求超時 - 請求超時
- 17. 如何在超時HTTP請求之前增加apache等待的時間?
- 18. 使用python請求在504超時之前增加時間
- 19. 增加傳遞給調用的超時值請求或增加綁定
- 20. NSURL請求超時請求
- 21. 如何增加谷歌語音API查詢請求超過50
- 22. 的JMeter:如何增加請求
- 23. 請求超時
- 24. 如何增加Linq2Entities的超時時間?
- 25. 紅寶石 - 增加代理請求超時
- 26. 如何增加對請求使用OAuth
- 27. 如何增加請求限制
- 28. POST請求的請求超時(H-12)
- 29. 如何增加SqlCommand的連接超時?
- 30. Corba請求超時