fix: Initialize transport object, set timeouts, and add IdleTimeout config

- Introduced idle connection timeout for HTTP client transport
- Implemented custom timeout for HTTP client when `RelayTimeout` is 0
- Set ImpatientHTTPClient timeout to 5 seconds
- Added new config variable `IdleTimeout` with default value of 30 seconds
- Utilized shared transport object for all HTTP clients in relay/util package
This commit is contained in:
Laisky.Cai
2024-03-08 12:58:05 +00:00
parent 758378e45a
commit 577ec90736
2 changed files with 13 additions and 3 deletions

View File

@@ -110,6 +110,7 @@ var BatchUpdateEnabled = false
var BatchUpdateInterval = helper.GetOrDefaultEnvInt("BATCH_UPDATE_INTERVAL", 5)
var RelayTimeout = helper.GetOrDefaultEnvInt("RELAY_TIMEOUT", 0) // unit is second
var IdleTimeout = helper.GetOrDefaultEnvInt("IDLE_TIMEOUT", 30) // unit is second
var GeminiSafetySetting = helper.GetOrDefaultEnvString("GEMINI_SAFETY_SETTING", "BLOCK_NONE")