diff --git a/src/ServiceControl.Audit.Persistence.RavenDB/CustomChecks/CheckDirtyMemory.cs b/src/ServiceControl.Audit.Persistence.RavenDB/CustomChecks/CheckDirtyMemory.cs index 85b02e55c5..1a81f67bee 100644 --- a/src/ServiceControl.Audit.Persistence.RavenDB/CustomChecks/CheckDirtyMemory.cs +++ b/src/ServiceControl.Audit.Persistence.RavenDB/CustomChecks/CheckDirtyMemory.cs @@ -8,7 +8,6 @@ namespace ServiceControl.Audit.Persistence.RavenDB.CustomChecks; class CheckDirtyMemory(MemoryInformationRetriever memoryInformationRetriever, ILogger logger) : CustomCheck("RavenDB dirty memory", "ServiceControl.Audit Health", TimeSpan.FromMinutes(5)) { - public override async Task PerformCheck(CancellationToken cancellationToken = default) { var (isHighDirty, dirtyMemory) = await memoryInformationRetriever.GetMemoryInformation(cancellationToken); diff --git a/src/ServiceControl.Audit.Persistence.RavenDB/MemoryInformationRetriever.cs b/src/ServiceControl.Audit.Persistence.RavenDB/MemoryInformationRetriever.cs index 5aff8c0fb7..3564d1bcb3 100644 --- a/src/ServiceControl.Audit.Persistence.RavenDB/MemoryInformationRetriever.cs +++ b/src/ServiceControl.Audit.Persistence.RavenDB/MemoryInformationRetriever.cs @@ -31,6 +31,8 @@ record MemoryInformation var httpResponse = await client.GetAsync("/admin/debug/memory/stats?includeThreads=false&includeMappings=false", cancellationToken); var responseDto = JsonSerializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(cancellationToken)); - return (responseDto.MemoryInformation.IsHighDirty, responseDto.MemoryInformation.DirtyMemory); + return responseDto.MemoryInformation is null + ? default + : (responseDto.MemoryInformation.IsHighDirty, responseDto.MemoryInformation.DirtyMemory); } } \ No newline at end of file diff --git a/src/ServiceControl.Persistence.RavenDB/MemoryInformationRetriever.cs b/src/ServiceControl.Persistence.RavenDB/MemoryInformationRetriever.cs index f7db4f2557..4e24e98ede 100644 --- a/src/ServiceControl.Persistence.RavenDB/MemoryInformationRetriever.cs +++ b/src/ServiceControl.Persistence.RavenDB/MemoryInformationRetriever.cs @@ -31,6 +31,8 @@ record MemoryInformation var httpResponse = await client.GetAsync("/admin/debug/memory/stats?includeThreads=false&includeMappings=false", cancellationToken); var responseDto = JsonSerializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(cancellationToken)); - return (responseDto.MemoryInformation.IsHighDirty, responseDto.MemoryInformation.DirtyMemory); + return responseDto.MemoryInformation is null + ? default + : (responseDto.MemoryInformation.IsHighDirty, responseDto.MemoryInformation.DirtyMemory); } } \ No newline at end of file