refactor(time): change DateTime from UTC to local time

- Change HealthCheckHtmlGenerator to use DateTime.Now instead of DateTime.UtcNow
- Change ProfileWorker health check timestamps to use DateTime.Now
- Change Program health check endpoint to use DateTime.Now
- Ensures consistent local time usage across the application
This commit is contained in:
2026-08-04 16:34:16 +02:00
parent 5b865c0442
commit 5b67035a07
3 changed files with 9 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ using ECMJobRunner.Application;
using ECMJobRunner.Infrastructure;
using ECMJobRunner.WebCron;
using ECMJobRunner.WebCron.HealthCheck;
using ECMJobRunner.WebCron.Middleware;
using ECMJobRunner.WebCron.ProfileWorker;
using Hangfire;
using Hangfire.SqlServer;
@@ -65,7 +66,7 @@ builder.Services.AddJobRunnerInfrastructure(cnnStr);
var recClientApiUrl = builder.Configuration.GetValue<string>("ReC:ApiUrl")
?? throw new InvalidOperationException("ReC:ApiUrl not found.");
builder.Services.AddJobRunnerServices(recClientApiUrl);
builder.Services.AddJobRunnerServices(recClientApiUrl, builder.Configuration);
// Get Hangfire storage configuration
var useInMemory = builder.Configuration.GetValue<bool>("Hangfire:InMemory");
@@ -105,7 +106,7 @@ builder.Services.AddSwaggerGen();
// Add health checks
builder.Services.AddHealthChecks()
.AddCheck<ProfileWorker>("profile-worker", tags: new[] { "ready", "worker" });
.AddCheck<ProfileWorker>("profile-worker", tags: ["ready", "worker"]);
// Add Serilog.UI with SQLite provider - use same path from configuration
var serilogUiLogDirectory = builder.Configuration.GetValue<string>("Application:LogDirectory")
@@ -123,6 +124,8 @@ builder.Services.AddSerilogUi(logUIOpt =>
var app = builder.Build();
app.UseMiddleware<ExceptionHandlingMiddleware>();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
@@ -171,7 +174,7 @@ app.MapHealthChecks("/health", new Microsoft.AspNetCore.Diagnostics.HealthChecks
var result = System.Text.Json.JsonSerializer.Serialize(new
{
status = report.Status.ToString(),
timestamp = DateTime.UtcNow,
timestamp = DateTime.Now,
checks = report.Entries.Select(e => new
{
name = e.Key,