fix: serialize database activity during playout

This commit is contained in:
2026-07-11 03:43:59 +09:00
parent 8dae7b8e0d
commit f76dbc7272
13 changed files with 327 additions and 46 deletions

View File

@@ -16,7 +16,9 @@ public sealed record DatabaseHealthStatus(
DatabaseHealthState State,
DateTimeOffset CheckedAt,
TimeSpan Elapsed,
string UserMessage);
string UserMessage,
bool? IsTransient = null,
int? ProviderErrorCode = null);
public interface IDatabaseHealthService
{
@@ -51,7 +53,9 @@ public sealed class DatabaseHealthService : IDatabaseHealthService
DatabaseHealthState.NotConfigured,
checkedAt,
TimeSpan.Zero,
"연결 정보가 설정되지 않았습니다.");
"연결 정보가 설정되지 않았습니다.",
IsTransient: null,
ProviderErrorCode: null);
}
var stopwatch = Stopwatch.StartNew();
@@ -73,7 +77,9 @@ public sealed class DatabaseHealthService : IDatabaseHealthService
DatabaseHealthState.Healthy,
checkedAt,
stopwatch.Elapsed,
"연결 정상");
"연결 정상",
IsTransient: null,
ProviderErrorCode: null);
}
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested)
{
@@ -86,7 +92,20 @@ public sealed class DatabaseHealthService : IDatabaseHealthService
DatabaseHealthState.TimedOut,
checkedAt,
stopwatch.Elapsed,
exception.Message);
exception.Message,
exception.IsTransient,
exception.ProviderErrorCode);
}
catch (DatabaseOperationException exception)
{
return new DatabaseHealthStatus(
source,
DatabaseHealthState.Unhealthy,
checkedAt,
stopwatch.Elapsed,
exception.Message,
exception.IsTransient,
exception.ProviderErrorCode);
}
catch (DatabaseInfrastructureException exception)
{
@@ -95,7 +114,9 @@ public sealed class DatabaseHealthService : IDatabaseHealthService
DatabaseHealthState.Unhealthy,
checkedAt,
stopwatch.Elapsed,
exception.Message);
exception.Message,
IsTransient: null,
ProviderErrorCode: null);
}
catch
{
@@ -104,7 +125,9 @@ public sealed class DatabaseHealthService : IDatabaseHealthService
DatabaseHealthState.Unhealthy,
checkedAt,
stopwatch.Elapsed,
"데이터베이스 연결 상태를 확인할 수 없습니다.");
"데이터베이스 연결 상태를 확인할 수 없습니다.",
IsTransient: null,
ProviderErrorCode: null);
}
}