Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.

Improve log content #102

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<BeatpulseRedisPackageVersion>3.0.1</BeatpulseRedisPackageVersion>
<BeatPulseSqlitePackageVersion>3.0.0</BeatPulseSqlitePackageVersion>
<BeatPulseSqlServerPackageVersion>3.0.0</BeatPulseSqlServerPackageVersion>
<BeatPulseUIPackageVersion>3.0.7</BeatPulseUIPackageVersion>
<BeatPulseUIPackageVersion>3.0.8</BeatPulseUIPackageVersion>
<BeatPulseKafkaVersion>3.0.0</BeatPulseKafkaVersion>
<BeatPulseEventStoreVersion>3.0.0</BeatPulseEventStoreVersion>
<BeatPulseRabbitMQPackageVersion>3.0.0</BeatPulseRabbitMQPackageVersion>
Expand Down
34 changes: 21 additions & 13 deletions src/BeatPulse.UI/Core/HostedService/LivenessHostedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ILivenessRunner>();
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<ILivenessRunner>();
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;
}
}
}
}
Expand Down