Add feature to enable HttpSessionRef idle timeout/period tuning. (#44)

This commit is contained in:
Eugene Kabanov 2023-03-22 13:20:49 +02:00 committed by GitHub
parent dc9829e24a
commit ba20cebf0f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -98,11 +98,14 @@ proc new*(t: typedesc[RestClientRef],
maxRedirections: int = HttpMaxRedirections,
connectTimeout = HttpConnectTimeout,
headersTimeout = HttpHeadersTimeout,
idleTimeout = HttpConnectionIdleTimeout,
idlePeriod = HttpConnectionCheckPeriod,
bufferSize: int = 4096,
userAgent = PrestoIdent
): RestResult[RestClientRef] =
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
headersTimeout, bufferSize, maxConnections)
headersTimeout, bufferSize, maxConnections,
idleTimeout, idlePeriod)
var uri = parseUri(url)
uri.path = ""
uri.query = ""
@ -126,11 +129,14 @@ proc new*(t: typedesc[RestClientRef],
maxRedirections: int = HttpMaxRedirections,
connectTimeout = HttpConnectTimeout,
headersTimeout = HttpHeadersTimeout,
idleTimeout = HttpConnectionIdleTimeout,
idlePeriod = HttpConnectionCheckPeriod,
bufferSize: int = 4096,
userAgent = PrestoIdent
): RestClientRef =
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
headersTimeout, bufferSize, maxConnections)
headersTimeout, bufferSize, maxConnections,
idleTimeout, idlePeriod)
let address = ta.getAddress(scheme, "")
RestClientRef(session: session, address: address, agent: userAgent,
flags: flags)