enforce one second loops
parent
e48da052b1
commit
16c6fe5704
|
@ -136,7 +136,9 @@ $lastGC = time();
|
||||||
|
|
||||||
while ($isRunning) {
|
while ($isRunning) {
|
||||||
$loopEnd = microtime(true) + 1;
|
$loopEnd = microtime(true) + 1;
|
||||||
$mqtt->loop(1000);
|
while (microtime(true) < $loopEnd) {
|
||||||
|
$mqtt->loop(100);
|
||||||
|
}
|
||||||
|
|
||||||
if ($lastGC + 60 < time()) {
|
if ($lastGC + 60 < time()) {
|
||||||
logit("doing Garbage collection...");
|
logit("doing Garbage collection...");
|
||||||
|
@ -145,10 +147,6 @@ while ($isRunning) {
|
||||||
$lastGC = time();
|
$lastGC = time();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($loopEnd > microtime(true)) {
|
|
||||||
usleep(intval($loopEnd - microtime(true)) * 1000000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($news && time() - $timer > 1) || time() - $timer > 15) {
|
if (($news && time() - $timer > 1) || time() - $timer > 15) {
|
||||||
logit("Outputting ", $news ? "for changes" : "periodically");
|
logit("Outputting ", $news ? "for changes" : "periodically");
|
||||||
output();
|
output();
|
||||||
|
|
Loading…
Reference in New Issue