From 7ca5814ce75b6d0a075d2c4770a77c536b658e46 Mon Sep 17 00:00:00 2001 From: Lars Windolf Date: Tue, 7 Jan 2014 15:27:16 +0100 Subject: [PATCH] Avoid negative connection count on Sphinx restart Difference calculation can go negative when Sphinx is restarted. This makes ugly spikes in the graph. --- plugins/sphinx/sphinx_connections | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/sphinx/sphinx_connections b/plugins/sphinx/sphinx_connections index da389a0a..029a6db2 100755 --- a/plugins/sphinx/sphinx_connections +++ b/plugins/sphinx/sphinx_connections @@ -54,6 +54,9 @@ if (!file_exists($sTmpFilePath)) { fclose($fp); $toShow = (int) ($iCurrent - (int) $iOldCount); + if ($toShow < 0) { + $toShow = 0; + } } echo "current.value $toShow\n";