Update dependencies.
[valheim_web.git] / backend / src / valheim_controller.rs
index f92e63d..aa0ff31 100644 (file)
@@ -37,11 +37,13 @@ impl ValheimExe {
     }\r
 \r
     pub fn format_active_players(&self) -> String {\r
+        /* Commented because the player list isn't correct (the number is).\r
         if self.active_players.len() == 0 {\r
             String::from("<none>")\r
         } else {\r
             self.active_players.join(", ")\r
-        }\r
+        }*/\r
+        self.active_players.len().to_string()\r
     }\r
 \r
     pub fn format_last_backup(&self) -> String {\r
@@ -81,6 +83,7 @@ const STRING_BEFORE_CHARACTER_NAME: &str = "Got character ZDOID from";
 #[cfg(target_os = "linux")]\r
 const STRING_BEFORE_NB_OF_CONNECTIONS: &str = "Connections";\r
 \r
+// It doesn't work for the moment, it only scan the connection event and do not treat disconnections.\r
 #[cfg(target_os = "linux")]\r
 fn get_active_players() -> Vec<String> {\r
     let mut journal =\r
@@ -162,7 +165,7 @@ pub fn get_valheim_executable_information(world_path: &str, backup_path: &str) -
         Some(\r
             ValheimExe {\r
                 memory: process.memory(),\r
-                load_average_5min: system.load_average().five / system.processors().len() as f64 * 100.,\r
+                load_average_5min: system.load_average().five / system.cpus().len() as f64 * 100.,\r
                 uptime: std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs() - process.start_time(),\r
                 world_size,\r
                 active_players: get_active_players(),\r