diff --git a/build/dependencies.props b/build/dependencies.props index f23e5d0..60b7d2e 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -56,7 +56,7 @@ 3.0.1 3.0.0 3.0.0 - 3.0.7 + 3.0.8 3.0.0 3.0.0 3.0.0 diff --git a/src/BeatPulse.UI/Core/HostedService/LivenessHostedService.cs b/src/BeatPulse.UI/Core/HostedService/LivenessHostedService.cs index 3e3838a..2a68985 100644 --- a/src/BeatPulse.UI/Core/HostedService/LivenessHostedService.cs +++ b/src/BeatPulse.UI/Core/HostedService/LivenessHostedService.cs @@ -46,24 +46,32 @@ private async Task ExecuteASync(CancellationToken cancellationToken) { while (!cancellationToken.IsCancellationRequested) { - _logger.LogDebug("Executing LivenessHostedService."); - - using (var scope = _serviceScopeFactory.CreateScope()) + try { - var runner = scope.ServiceProvider.GetRequiredService(); - try - { - await runner.Run(cancellationToken); + _logger.LogDebug("Executing LivenessHostedService."); - _logger.LogDebug("LivenessHostedService executed succesfully."); - } - catch (Exception ex) + using (var scope = _serviceScopeFactory.CreateScope()) { - _logger.LogError("LivenessHostedService throw a error:", ex); + var runner = scope.ServiceProvider.GetRequiredService(); + try + { + await runner.Run(cancellationToken); + + _logger.LogDebug("LivenessHostedService executed successfully."); + } + catch (Exception ex) + { + _logger.LogError(ex, "LivenessHostedService throw a error:"); + } } - } - await Task.Delay(_settings.EvaluationTimeOnSeconds * 1000, cancellationToken); + await Task.Delay(_settings.EvaluationTimeOnSeconds * 1000, cancellationToken); + } + catch (Exception ex) + { + _logger.LogError(ex, "Exception has been thrown during execution of LivenessRunner"); + throw; + } } } }