WebServiceAppsApi: replaced WithTimeout() usage with TimeoutAsync().

This commit is contained in:
Shreyas Zare
2024-09-14 19:32:27 +05:30
parent 0a88cfcdd9
commit a4e5bf8070

View File

@@ -29,7 +29,6 @@ using System.Net.Http;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using TechnitiumLibrary;
using TechnitiumLibrary.Net.Http.Client;
namespace DnsServerCore
@@ -346,7 +345,11 @@ namespace DnsServerCore
{
try
{
string storeAppsJsonData = await GetStoreAppsJsonData(false).WithTimeout(5000);
string storeAppsJsonData = await TechnitiumLibrary.TaskExtensions.TimeoutAsync(delegate (CancellationToken cancellationToken1)
{
return GetStoreAppsJsonData(false);
}, 5000);
jsonDocument = JsonDocument.Parse(storeAppsJsonData);
jsonStoreAppsArray = jsonDocument.RootElement;
}
@@ -383,7 +386,11 @@ namespace DnsServerCore
if (!_dnsWebService._authManager.IsPermitted(PermissionSection.Apps, session.User, PermissionFlag.View))
throw new DnsWebServiceException("Access was denied.");
string storeAppsJsonData = await GetStoreAppsJsonData(false).WithTimeout(30000);
string storeAppsJsonData = await TechnitiumLibrary.TaskExtensions.TimeoutAsync(delegate (CancellationToken cancellationToken1)
{
return GetStoreAppsJsonData(false);
}, 30000);
using JsonDocument jsonDocument = JsonDocument.Parse(storeAppsJsonData);
JsonElement jsonStoreAppsArray = jsonDocument.RootElement;