mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-16 10:53:08 +00:00
added ability to set optional http client for preventing connection pool exhaustion https://stackoverflow.com/a/48778707/4993930
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using CryptoExchange.Net.Authentication;
|
||||
using CryptoExchange.Net.Interfaces;
|
||||
using CryptoExchange.Net.Logging;
|
||||
@@ -126,7 +127,10 @@ namespace CryptoExchange.Net.Objects
|
||||
/// The time the server has to respond to a request before timing out
|
||||
/// </summary>
|
||||
public TimeSpan RequestTimeout { get; set; } = TimeSpan.FromSeconds(30);
|
||||
|
||||
/// <summary>
|
||||
/// http client
|
||||
/// </summary>
|
||||
public HttpClient? HttpClient;
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
@@ -134,7 +138,15 @@ namespace CryptoExchange.Net.Objects
|
||||
public RestClientOptions(string baseAddress): base(baseAddress)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ctor
|
||||
/// </summary>
|
||||
/// <param name="baseAddress"></param>
|
||||
/// <param name="httpClient">Shared http client</param>
|
||||
public RestClientOptions(HttpClient httpClient, string baseAddress) : base(baseAddress)
|
||||
{
|
||||
HttpClient = httpClient;
|
||||
}
|
||||
/// <summary>
|
||||
/// Create a copy of the options
|
||||
/// </summary>
|
||||
@@ -150,7 +162,8 @@ namespace CryptoExchange.Net.Objects
|
||||
LogWriters = LogWriters,
|
||||
RateLimiters = RateLimiters,
|
||||
RateLimitingBehaviour = RateLimitingBehaviour,
|
||||
RequestTimeout = RequestTimeout
|
||||
RequestTimeout = RequestTimeout,
|
||||
HttpClient = HttpClient
|
||||
};
|
||||
|
||||
if (ApiCredentials != null)
|
||||
|
||||
Reference in New Issue
Block a user