fix: loopOnce CPU fix + SWITCH_PRIMARY race condition fix
This commit is contained in:
parent
e95740ec8c
commit
050a4cdc5d
@ -592,10 +592,11 @@ while (true) {
|
||||
);
|
||||
|
||||
$nextMainCheck = time() + 10;
|
||||
$loopStartedAt = microtime(true);
|
||||
|
||||
while ($mqtt->isConnected()) {
|
||||
|
||||
$mqtt->loop(false);
|
||||
$mqtt->loopOnce($loopStartedAt, true, 100000);
|
||||
|
||||
if (time() >= $nextMainCheck) {
|
||||
|
||||
@ -617,9 +618,7 @@ while (true) {
|
||||
"MAIN broker online"
|
||||
);
|
||||
|
||||
logmsg(
|
||||
"Mandar switch_primary"
|
||||
);
|
||||
logmsg("Mandar switch_primary");
|
||||
|
||||
send_switch_primary(
|
||||
$mqtt,
|
||||
@ -635,7 +634,6 @@ while (true) {
|
||||
}
|
||||
}
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
$mqtt->disconnect();
|
||||
|
||||
@ -188,10 +188,11 @@ while (true) {
|
||||
logmsg("TLS ligado");
|
||||
|
||||
$nextOfflineCheck = time() + 15;
|
||||
$loopStartedAt = microtime(true);
|
||||
|
||||
while ($mqttTls->isConnected()) {
|
||||
|
||||
$mqttTls->loop(true, false);
|
||||
$mqttTls->loopOnce($loopStartedAt, true, 100000);
|
||||
|
||||
if (time() >= $nextOfflineCheck) {
|
||||
$nextOfflineCheck = time() + 15;
|
||||
@ -208,7 +209,6 @@ while (true) {
|
||||
}
|
||||
}
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
$mqttTls->disconnect();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user