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. 請求超時增加超過30秒?
- 2. 如何增加Web服務請求的超時時間?
- 3. WildFly增大請求超時
- 4. 如何增加特定腳本的請求超時php fpm
- 5. 如何增加IIS中的請求超時?
- 6. Ajax請求在10分鐘後超時,如何增加它
- 7. 如何增加Azure應用服務230秒請求超時
- 8. 如何增加空中客戶端http請求超時?
- 9. 如何添加請求超時異常
- 10. 是否可以增加Google Cloud Datastore請求的超時時間?
- 11. 請求超時 - 請求超時
- 12. 如何在超時HTTP請求之前增加apache等待的時間?
- 13. 使用python請求在504超時之前增加時間
- 14. 如何增加谷歌語音API查詢請求超過50
- 15. 如何增加Linq2Entities的超時時間?
- 16. 如何增加請求限制
- 17. 如何增加對請求使用OAuth
- 18. 如何增加SqlCommand的連接超時?
- 19. KSoap請求超時?
- 20. 超時ASIHTTP請求
- 21. IIS請求超時
- 22. Tomcat請求超時
- 23. NSXMLParser - 請求超時
- 24. HTTP請求超時
- 25. Web請求超時
- 26. Corba請求超時
- 27. Codeception - 如何更改請求超時?
- 28. 增加h2o.init超時
- 29. 增加RunAsync超時
- 30. node.js請求中的超時