fix: serialize database activity during playout
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user