From b32ff11c61b145dd22cd09ed909e27675ed6cb14 Mon Sep 17 00:00:00 2001 From: Lars Windolf Date: Tue, 7 Jan 2014 15:28:01 +0100 Subject: [PATCH] Avoid negative queries count on Sphinx restart Difference calculation can go negative when Sphinx is restarted. This makes ugly spikes in the graph. --- plugins/sphinx/sphinx_queries | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/sphinx/sphinx_queries b/plugins/sphinx/sphinx_queries index 0862b7c3..7a9d9527 100755 --- a/plugins/sphinx/sphinx_queries +++ b/plugins/sphinx/sphinx_queries @@ -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";