File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,13 @@ pub fn spawn_resource_monitor(shutdown_rx: tokio::sync::oneshot::Receiver<()>) {
49
49
trace!( "Checking system resource utilization..." ) ;
50
50
51
51
refresh_sys_info( ) ;
52
- let ( used_memory, total_memory, cpu_usage) = {
52
+ let ( used_memory, total_memory, cpu_usage) = tokio :: task :: spawn_blocking ( || {
53
53
let sys = SYS_INFO . lock( ) . unwrap( ) ;
54
54
let used_memory = sys. used_memory( ) as f32 ;
55
55
let total_memory = sys. total_memory( ) as f32 ;
56
56
let cpu_usage = sys. global_cpu_usage( ) ;
57
57
( used_memory, total_memory, cpu_usage)
58
- } ;
58
+ } ) . await . unwrap ( ) ;
59
59
60
60
let mut resource_ok = true ;
61
61
@@ -67,7 +67,7 @@ pub fn spawn_resource_monitor(shutdown_rx: tokio::sync::oneshot::Receiver<()>) {
67
67
} ;
68
68
69
69
// Log current resource usage every few checks for debugging
70
- info!( "Current resource usage - CPU: {:.1}%, Memory: {:.1}% ({:.1}GB /{:.1}GB )" ,
70
+ info!( "Current resource usage - CPU: {:.1}%, Memory: {:.1}% ({:.1}GiB /{:.1}GiB )" ,
71
71
cpu_usage, memory_usage,
72
72
used_memory / 1024.0 / 1024.0 / 1024.0 ,
73
73
total_memory / 1024.0 / 1024.0 / 1024.0 ) ;
You can’t perform that action at this time.
0 commit comments