Add feature to enable HttpSessionRef idle timeout/period tuning. (#44)
This commit is contained in:
parent
dc9829e24a
commit
ba20cebf0f
|
@ -98,11 +98,14 @@ proc new*(t: typedesc[RestClientRef],
|
||||||
maxRedirections: int = HttpMaxRedirections,
|
maxRedirections: int = HttpMaxRedirections,
|
||||||
connectTimeout = HttpConnectTimeout,
|
connectTimeout = HttpConnectTimeout,
|
||||||
headersTimeout = HttpHeadersTimeout,
|
headersTimeout = HttpHeadersTimeout,
|
||||||
|
idleTimeout = HttpConnectionIdleTimeout,
|
||||||
|
idlePeriod = HttpConnectionCheckPeriod,
|
||||||
bufferSize: int = 4096,
|
bufferSize: int = 4096,
|
||||||
userAgent = PrestoIdent
|
userAgent = PrestoIdent
|
||||||
): RestResult[RestClientRef] =
|
): RestResult[RestClientRef] =
|
||||||
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
|
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
|
||||||
headersTimeout, bufferSize, maxConnections)
|
headersTimeout, bufferSize, maxConnections,
|
||||||
|
idleTimeout, idlePeriod)
|
||||||
var uri = parseUri(url)
|
var uri = parseUri(url)
|
||||||
uri.path = ""
|
uri.path = ""
|
||||||
uri.query = ""
|
uri.query = ""
|
||||||
|
@ -126,11 +129,14 @@ proc new*(t: typedesc[RestClientRef],
|
||||||
maxRedirections: int = HttpMaxRedirections,
|
maxRedirections: int = HttpMaxRedirections,
|
||||||
connectTimeout = HttpConnectTimeout,
|
connectTimeout = HttpConnectTimeout,
|
||||||
headersTimeout = HttpHeadersTimeout,
|
headersTimeout = HttpHeadersTimeout,
|
||||||
|
idleTimeout = HttpConnectionIdleTimeout,
|
||||||
|
idlePeriod = HttpConnectionCheckPeriod,
|
||||||
bufferSize: int = 4096,
|
bufferSize: int = 4096,
|
||||||
userAgent = PrestoIdent
|
userAgent = PrestoIdent
|
||||||
): RestClientRef =
|
): RestClientRef =
|
||||||
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
|
let session = HttpSessionRef.new(httpFlags, maxRedirections, connectTimeout,
|
||||||
headersTimeout, bufferSize, maxConnections)
|
headersTimeout, bufferSize, maxConnections,
|
||||||
|
idleTimeout, idlePeriod)
|
||||||
let address = ta.getAddress(scheme, "")
|
let address = ta.getAddress(scheme, "")
|
||||||
RestClientRef(session: session, address: address, agent: userAgent,
|
RestClientRef(session: session, address: address, agent: userAgent,
|
||||||
flags: flags)
|
flags: flags)
|
||||||
|
|
Loading…
Reference in New Issue