Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into #170-Add-support-for-…
Browse files Browse the repository at this point in the history
…the-v1.IATSSCD-interface
  • Loading branch information
forsthug committed Apr 10, 2024
2 parents b411d12 + 5287a8f commit 7453283
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 5 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public void Encrypt(IDataProtector dataProtector)
{
return dataProtector.Protect((string)value);
}
catch (Exception e)
catch
{
Log.Warning($"Failed to encrypt value of configuration field {name}. Consider using the 'config set' command to set the field's value.", name);
return null;
Expand Down
5 changes: 2 additions & 3 deletions src/fiskaltrust.Launcher/Helpers/PolicyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public sealed class PolicyHttpClient : IDisposable
public PolicyHttpClient(LauncherConfiguration configuration, HttpClient httpClient)
{
_httpClient = httpClient;
_httpClient.Timeout = TimeSpan.FromSeconds(configuration.DownloadTimeoutSec!.Value);
_policy = GetPolicy(configuration);
}

Expand All @@ -24,9 +25,7 @@ private IAsyncPolicy<HttpResponseMessage> GetPolicy(LauncherConfiguration config
configuration.DownloadRetry!.Value,
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));

var timeoutPolicy = Policy.TimeoutAsync<HttpResponseMessage>(configuration.DownloadTimeoutSec!.Value);

return Policy.WrapAsync(retryPolicy, timeoutPolicy);
return retryPolicy;
}

public Task<HttpResponseMessage> SendAsync(Func<HttpRequestMessage> getMessage) => _policy.ExecuteAsync(ct => _httpClient.SendAsync(getMessage(), ct), CancellationToken.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task DownloadConfigurationAsync_ShouldTimeout()
var downloader = new ConfigurationDownloader(config, httpClient);

var clientCurve = ECDiffieHellman.Create();
await Assert.ThrowsAsync<TimeoutRejectedException>(() => downloader.DownloadConfigurationAsync(clientCurve));
await Assert.ThrowsAsync<TaskCanceledException>(() => downloader.DownloadConfigurationAsync(clientCurve));
}
}
}

0 comments on commit 7453283

Please sign in to comment.