Skip to content

Commit c10d717

Browse files
committed
add RestClientSingleton
1 parent c084149 commit c10d717

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,3 +350,4 @@ MigrationBackup/
350350
.ionide/
351351

352352

353+
/.idea
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Net.Http;
3+
using RestSharp;
4+
5+
namespace FikaAmazonAPI.AmazonSpApiSDK.Runtime
6+
{
7+
public class RestClientSingleton
8+
{
9+
private static readonly HttpClient _httpClient = new HttpClient(new StandardSocketsHttpHandler
10+
{
11+
PooledConnectionLifetime = TimeSpan.FromMinutes(15)
12+
});
13+
14+
static RestClientSingleton()
15+
{
16+
}
17+
18+
private RestClientSingleton()
19+
{
20+
}
21+
22+
public static RestClient RestClient => new RestClient(_httpClient);
23+
}
24+
}

Source/FikaAmazonAPI/FikaAmazonAPI.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@
3838
<PackageReference Include="AWSSDK.SecurityToken" Version="3.7.100.52" />
3939
<PackageReference Include="AWSSDK.SQS" Version="3.7.100.52" />
4040
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
41+
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
4142
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
4243
<PackageReference Include="RestSharp" Version="108.0.3" />
4344
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="108.0.3" />
45+
<PackageReference Include="StandardSocketsHttpHandler" Version="2.2.0.4" />
4446
<PackageReference Include="System.Collections" Version="4.3.0" />
4547
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
4648
<PackageReference Include="System.Reflection" Version="4.3.0" />

0 commit comments

Comments
 (0)