aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBuckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com>2020-09-25 18:52:42 +0200
committerGitHub <noreply@github.com>2020-09-25 18:52:42 +0200
commitc6e3050357e8378ad15e7fa7a9aa80f3936fbc2d (patch)
tree82d16da643461219a8249e53fb37429777aafd13
parent9bff154cba14686f5a3b56f4cba405824b88c402 (diff)
downloadminetest-c6e3050357e8378ad15e7fa7a9aa80f3936fbc2d.tar.gz
minetest-c6e3050357e8378ad15e7fa7a9aa80f3936fbc2d.tar.bz2
minetest-c6e3050357e8378ad15e7fa7a9aa80f3936fbc2d.zip
Correct erroneous reported max lag with prometheus (#10427)
Co-authored-by: BuckarooBanzay <BuckarooBanzay@users.noreply.github.com>
-rw-r--r--src/server.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index b8a99f6ae..456edfeb8 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -653,7 +653,12 @@ void Server::AsyncRunStep(bool initial_step)
}
m_clients.step(dtime);
- m_lag_gauge->increment((m_lag_gauge->get() > dtime ? -1 : 1) * dtime/100);
+ // increase/decrease lag gauge gradually
+ if (m_lag_gauge->get() > dtime) {
+ m_lag_gauge->decrement(dtime/100);
+ } else {
+ m_lag_gauge->increment(dtime/100);
+ }
#if USE_CURL
// send masterserver announce
{