X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=backend%2Fsrc%2Fvalheim_controller.rs;h=aa0ff319ba415f1c39f5f6a431b8fd434accfeda;hb=c6b54f676e513e2b43a9190f2afae5178641f978;hp=f92e63d459fc6735bdc3b591f7e4970db4b98f39;hpb=aa59a1f9b79009079a5a1fbafd4f65d3130e9ee2;p=valheim_web.git diff --git a/backend/src/valheim_controller.rs b/backend/src/valheim_controller.rs index f92e63d..aa0ff31 100644 --- a/backend/src/valheim_controller.rs +++ b/backend/src/valheim_controller.rs @@ -37,11 +37,13 @@ impl ValheimExe { } pub fn format_active_players(&self) -> String { + /* Commented because the player list isn't correct (the number is). if self.active_players.len() == 0 { String::from("") } else { self.active_players.join(", ") - } + }*/ + self.active_players.len().to_string() } pub fn format_last_backup(&self) -> String { @@ -81,6 +83,7 @@ const STRING_BEFORE_CHARACTER_NAME: &str = "Got character ZDOID from"; #[cfg(target_os = "linux")] const STRING_BEFORE_NB_OF_CONNECTIONS: &str = "Connections"; +// It doesn't work for the moment, it only scan the connection event and do not treat disconnections. #[cfg(target_os = "linux")] fn get_active_players() -> Vec { let mut journal = @@ -162,7 +165,7 @@ pub fn get_valheim_executable_information(world_path: &str, backup_path: &str) - Some( ValheimExe { memory: process.memory(), - load_average_5min: system.load_average().five / system.processors().len() as f64 * 100., + load_average_5min: system.load_average().five / system.cpus().len() as f64 * 100., uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(), world_size, active_players: get_active_players(),