diff --git a/mqtt2prom/run b/mqtt2prom/run index 59bd8f7..0f6fa81 100755 --- a/mqtt2prom/run +++ b/mqtt2prom/run @@ -136,7 +136,9 @@ $lastGC = time(); while ($isRunning) { $loopEnd = microtime(true) + 1; - $mqtt->loop(1000); + while (microtime(true) < $loopEnd) { + $mqtt->loop(100); + } if ($lastGC + 60 < time()) { logit("doing Garbage collection..."); @@ -145,10 +147,6 @@ while ($isRunning) { $lastGC = time(); } - if ($loopEnd > microtime(true)) { - usleep(intval($loopEnd - microtime(true)) * 1000000); - } - if (($news && time() - $timer > 1) || time() - $timer > 15) { logit("Outputting ", $news ? "for changes" : "periodically"); output();