diff --git a/Matrix.Sdk/Core/Infrastructure/Services/BaseApiService.cs b/Matrix.Sdk/Core/Infrastructure/Services/BaseApiService.cs index 1768903..c496bfb 100644 --- a/Matrix.Sdk/Core/Infrastructure/Services/BaseApiService.cs +++ b/Matrix.Sdk/Core/Infrastructure/Services/BaseApiService.cs @@ -10,6 +10,7 @@ public abstract class BaseApiService private readonly IHttpClientFactory _httpClientFactory; public Uri? BaseAddress { get; set; } + private static TimeSpan DefaultTimeout => TimeSpan.FromMilliseconds(Constants.LaterSyncTimout + 10000); protected BaseApiService(IHttpClientFactory httpClientFactory) { @@ -26,7 +27,7 @@ protected BaseApiService(IHttpClientFactory httpClientFactory) /// HttpClient protected HttpClient CreateHttpClient(string? accessToken = null) { - HttpClient httpClient = _httpClientFactory.CreateClient(Constants.Matrix); + var httpClient = _httpClientFactory.CreateClient(Constants.Matrix); if (accessToken != null) httpClient.AddBearerToken(accessToken); @@ -37,7 +38,8 @@ protected HttpClient CreateHttpClient(string? accessToken = null) if (httpClient.BaseAddress == null) httpClient.BaseAddress = BaseAddress; - httpClient.Timeout = TimeSpan.FromMilliseconds(Constants.LaterSyncTimout + 10000); + if (httpClient.Timeout != DefaultTimeout) + httpClient.Timeout = DefaultTimeout; return httpClient; } diff --git a/Matrix.Sdk/Matrix.Sdk.csproj b/Matrix.Sdk/Matrix.Sdk.csproj index b2983a2..2a04513 100644 --- a/Matrix.Sdk/Matrix.Sdk.csproj +++ b/Matrix.Sdk/Matrix.Sdk.csproj @@ -14,7 +14,7 @@ Mikhail Tatarenko Matrix.Sdk This open-source library allows you to build .NET apps compatible with Matrix Protocol - http://www.matrix.org. - 1.0.1 + 1.0.2 Copyright © Baking Bad 2019-2022 enable netstandard2.0