diff --git a/src/OutlookAddin/Services/AddInHost.cs b/src/OutlookAddin/Services/AddInHost.cs index c95bf34..c70d5b9 100644 --- a/src/OutlookAddin/Services/AddInHost.cs +++ b/src/OutlookAddin/Services/AddInHost.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net.Http; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows; @@ -36,6 +37,7 @@ namespace OutlookAddin.Services private readonly Outlook.Application _outlookApp; private RetryQueueProcessor? _retryProcessor; + private HttpClient? _httpClient; public AddInHost(Outlook.Application outlookApp) { @@ -70,7 +72,8 @@ namespace OutlookAddin.Services try { - CrmClient = new EspoCrmClient(baseUrl, creds.Username, creds.ApiKey, Logger); + _httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) }; + CrmClient = new EspoCrmClient(_httpClient, baseUrl.ToString(), creds.Username, creds.ApiKey, Logger); FilingService = new FilingService(CrmClient, RetryQueue, Logger); _retryProcessor = new RetryQueueProcessor(RetryQueue, CrmClient, Logger); _retryProcessor.Start(); @@ -318,6 +321,7 @@ namespace OutlookAddin.Services public void Dispose() { try { _retryProcessor?.Dispose(); } catch { } + try { _httpClient?.Dispose(); } catch { } try { Logger.Information("AddInHost shutting down");