enforce one second loops
parent
e48da052b1
commit
16c6fe5704
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue