From 96049904a6996f336755328a9ba514bd50d22422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Sun, 21 Mar 2021 18:33:39 +0100 Subject: [PATCH] add keepalive in server-cli so we know it still ticks, ~ all 30s --- server-cli/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server-cli/src/main.rs b/server-cli/src/main.rs index 4fcc89b1ba..d53545e059 100644 --- a/server-cli/src/main.rs +++ b/server-cli/src/main.rs @@ -23,7 +23,7 @@ use std::{ sync::{atomic::AtomicBool, mpsc, Arc}, time::Duration, }; -use tracing::info; +use tracing::{info, trace}; const TPS: u64 = 30; @@ -164,7 +164,9 @@ fn main() -> io::Result<()> { let mut clock = Clock::new(Duration::from_secs_f64(1.0 / TPS as f64)); // Wait for a tick so we don't start with a zero dt + let mut tick_no = 0u64; loop { + tick_no += 1; span!(guard, "work"); // Terminate the server if instructed to do so by the shutdown coordinator if shutdown_coordinator.check(&mut server, &settings) { @@ -186,6 +188,10 @@ fn main() -> io::Result<()> { // Clean up the server after a tick. server.cleanup(); + if tick_no.rem_euclid(1000) == 0 { + trace!(?tick_no, "keepalive") + } + if let Some(tui) = tui.as_ref() { match tui.msg_r.try_recv() { Ok(msg) => match msg {