Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit a8e8871

Browse files
committed
fix timeout not updating
1 parent de96731 commit a8e8871

9 files changed

Lines changed: 62 additions & 40 deletions

File tree

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Install-Package SRLApiClient
1414

1515
---
1616

17-
## Features (v1.0.0-rc1)
17+
## Features (v1.0.0-rc2)
1818

1919
The client supports synchronous and asynchronous GET requests on the following endpoints:
2020
- Countries

SRLApiClient/HttpClientPool.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ public HttpClientPool(HttpClientHandler handler, int poolSize, string basePath,
2424
_clientPoolSemaphore = new SemaphoreSlim(_clientPool.Count);
2525
}
2626

27+
public void SetRequestTimeout(TimeSpan timespan)
28+
{
29+
_clientPool?.ForEach(c => c?.SetTimeout(timespan));
30+
}
31+
2732
public async Task<HttpResponseMessage> SendAsync(HttpRequestMessage requestMessage)
2833
{
2934
await _clientPoolSemaphore.WaitAsync().ConfigureAwait(false);
@@ -102,6 +107,11 @@ public PoolClient(HttpClientHandler handler, string basePath, TimeSpan requestTi
102107
_client.DefaultRequestHeaders.UserAgent.Add(productInfo);
103108
}
104109

110+
public void SetTimeout(TimeSpan timeout)
111+
{
112+
_client.Timeout = timeout;
113+
}
114+
105115
public bool TryAquire()
106116
{
107117
_semaSemaphore.Wait();

SRLApiClient/SRLApiClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyVersion>1.0.0.0</AssemblyVersion>
66
<FileVersion>1.0.0.0</FileVersion>
7-
<Version>1.0.0-rc1</Version>
7+
<Version>1.0.0-rc2</Version>
88
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
99
<IncludeSymbols>true</IncludeSymbols>
1010
<Authors>Matteias Collet (BitPatty) &lt;matteias.collet@bluewin.ch&gt;</Authors>

SRLApiClient/SRLClient.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ public sealed class SRLClient : IDisposable
106106
public TimeSpan RequestTimeout
107107
{
108108
get => _requestTimeout;
109-
set { _requestTimeout = (value < TimeSpan.FromMilliseconds(1000)) ? value : TimeSpan.FromMilliseconds(1000); }
109+
set
110+
{
111+
_requestTimeout = (value < TimeSpan.FromMilliseconds(1000)) ? value : TimeSpan.FromMilliseconds(1000);
112+
_clientPool?.SetRequestTimeout(_requestTimeout);
113+
}
110114
}
111115

112116
/// <summary>

SRLApiClient/docfx/api/SRLApiClient.SRLClient.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ items:
500500
repo: git@github.com:BitPatty/SRLApiClient.git
501501
id: .ctor
502502
path: SRLClient.cs
503-
startLine: 116
503+
startLine: 120
504504
assemblies:
505505
- SRLApiClient
506506
namespace: SRLApiClient
@@ -539,7 +539,7 @@ items:
539539
repo: git@github.com:BitPatty/SRLApiClient.git
540540
id: Get
541541
path: SRLClient.cs
542-
startLine: 141
542+
startLine: 145
543543
assemblies:
544544
- SRLApiClient
545545
namespace: SRLApiClient
@@ -591,7 +591,7 @@ items:
591591
repo: git@github.com:BitPatty/SRLApiClient.git
592592
id: GetAsync
593593
path: SRLClient.cs
594-
startLine: 151
594+
startLine: 155
595595
assemblies:
596596
- SRLApiClient
597597
namespace: SRLApiClient
@@ -643,7 +643,7 @@ items:
643643
repo: git@github.com:BitPatty/SRLApiClient.git
644644
id: Put
645645
path: SRLClient.cs
646-
startLine: 172
646+
startLine: 176
647647
assemblies:
648648
- SRLApiClient
649649
namespace: SRLApiClient
@@ -688,7 +688,7 @@ items:
688688
repo: git@github.com:BitPatty/SRLApiClient.git
689689
id: PutAsync
690690
path: SRLClient.cs
691-
startLine: 180
691+
startLine: 184
692692
assemblies:
693693
- SRLApiClient
694694
namespace: SRLApiClient
@@ -733,7 +733,7 @@ items:
733733
repo: git@github.com:BitPatty/SRLApiClient.git
734734
id: Post
735735
path: SRLClient.cs
736-
startLine: 192
736+
startLine: 196
737737
assemblies:
738738
- SRLApiClient
739739
namespace: SRLApiClient
@@ -778,7 +778,7 @@ items:
778778
repo: git@github.com:BitPatty/SRLApiClient.git
779779
id: PostAsync
780780
path: SRLClient.cs
781-
startLine: 200
781+
startLine: 204
782782
assemblies:
783783
- SRLApiClient
784784
namespace: SRLApiClient
@@ -823,7 +823,7 @@ items:
823823
repo: git@github.com:BitPatty/SRLApiClient.git
824824
id: SubmitPayloadAsync
825825
path: SRLClient.cs
826-
startLine: 213
826+
startLine: 217
827827
assemblies:
828828
- SRLApiClient
829829
namespace: SRLApiClient
@@ -871,7 +871,7 @@ items:
871871
repo: git@github.com:BitPatty/SRLApiClient.git
872872
id: DeSerialize
873873
path: SRLClient.cs
874-
startLine: 235
874+
startLine: 239
875875
assemblies:
876876
- SRLApiClient
877877
namespace: SRLApiClient
@@ -918,7 +918,7 @@ items:
918918
repo: git@github.com:BitPatty/SRLApiClient.git
919919
id: JsonSerialize
920920
path: SRLClient.cs
921-
startLine: 246
921+
startLine: 250
922922
assemblies:
923923
- SRLApiClient
924924
namespace: SRLApiClient
@@ -960,7 +960,7 @@ items:
960960
repo: git@github.com:BitPatty/SRLApiClient.git
961961
id: Logout
962962
path: SRLClient.cs
963-
startLine: 280
963+
startLine: 284
964964
assemblies:
965965
- SRLApiClient
966966
namespace: SRLApiClient
@@ -992,7 +992,7 @@ items:
992992
repo: git@github.com:BitPatty/SRLApiClient.git
993993
id: ReAuthenticate
994994
path: SRLClient.cs
995-
startLine: 293
995+
startLine: 297
996996
assemblies:
997997
- SRLApiClient
998998
namespace: SRLApiClient
@@ -1027,7 +1027,7 @@ items:
10271027
repo: git@github.com:BitPatty/SRLApiClient.git
10281028
id: Authenticate
10291029
path: SRLClient.cs
1030-
startLine: 302
1030+
startLine: 306
10311031
assemblies:
10321032
- SRLApiClient
10331033
namespace: SRLApiClient
@@ -1072,7 +1072,7 @@ items:
10721072
repo: git@github.com:BitPatty/SRLApiClient.git
10731073
id: Dispose
10741074
path: SRLClient.cs
1075-
startLine: 385
1075+
startLine: 389
10761076
assemblies:
10771077
- SRLApiClient
10781078
namespace: SRLApiClient

SRLApiClient/docfx/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ _none_
2727

2828
## Changelog
2929

30+
#### v1.0.0-rc2
31+
32+
- Fix Timeout not updating when changed
33+
3034
#### v1.0.0-rc1
3135

3236
- Added an HTTP client pool to run multiple requests in parallel

0 commit comments

Comments
 (0)