Merge branch 'xMAC94x/keepalive' into 'master'

add keepalive in server-cli so we know it still ticks, ~ all 30s

See merge request veloren/veloren!1960
This commit is contained in:
Marcel 2021-03-21 18:34:27 +00:00
commit b9f8aff75e

View File

@ -23,7 +23,7 @@ use std::{
sync::{atomic::AtomicBool, mpsc, Arc}, sync::{atomic::AtomicBool, mpsc, Arc},
time::Duration, time::Duration,
}; };
use tracing::info; use tracing::{info, trace};
const TPS: u64 = 30; 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)); 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 // Wait for a tick so we don't start with a zero dt
let mut tick_no = 0u64;
loop { loop {
tick_no += 1;
span!(guard, "work"); span!(guard, "work");
// Terminate the server if instructed to do so by the shutdown coordinator // Terminate the server if instructed to do so by the shutdown coordinator
if shutdown_coordinator.check(&mut server, &settings) { if shutdown_coordinator.check(&mut server, &settings) {
@ -186,6 +188,10 @@ fn main() -> io::Result<()> {
// Clean up the server after a tick. // Clean up the server after a tick.
server.cleanup(); server.cleanup();
if tick_no.rem_euclid(1000) == 0 {
trace!(?tick_no, "keepalive")
}
if let Some(tui) = tui.as_ref() { if let Some(tui) = tui.as_ref() {
match tui.msg_r.try_recv() { match tui.msg_r.try_recv() {
Ok(msg) => match msg { Ok(msg) => match msg {