File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/ServiceControl.Audit.Persistence.RavenDB Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -22,11 +22,16 @@ record MemoryInformation
2222 public string DirtyMemory { get ; set ; }
2323 }
2424
25- public async Task < ( bool IsHighDirty , int DirtyMemory ) > GetMemoryInformation ( CancellationToken cancellationToken = default )
25+ public async Task < ( bool IsHighDirty , int DirtyMemoryKb ) > GetMemoryInformation ( CancellationToken cancellationToken = default )
2626 {
2727 var httpResponse = await client . GetAsync ( "/admin/debug/memory/stats" , cancellationToken ) ;
2828 var responseDto = JsonSerializer . Deserialize < ResponseDto > ( await httpResponse . Content . ReadAsStringAsync ( cancellationToken ) ) ;
2929
30- return ( responseDto . MemoryInformation . IsHighDirty , int . Parse ( responseDto . MemoryInformation . DirtyMemory . Split ( ' ' ) . First ( ) ) ) ;
30+ var values = responseDto . MemoryInformation . DirtyMemory . Split ( ' ' ) ;
31+ if ( ! string . Equals ( values [ 1 ] , "KBytes" , StringComparison . OrdinalIgnoreCase ) )
32+ {
33+ throw new InvalidOperationException ( $ "Unexpected response. Was expecting memory details in KBytes, instead received: { responseDto . MemoryInformation . DirtyMemory } ") ;
34+ }
35+ return ( responseDto . MemoryInformation . IsHighDirty , int . Parse ( values [ 0 ] ) ) ;
3136 }
3237}
You can’t perform that action at this time.
0 commit comments