From: Vincent Date: Thu, 29 Aug 2019 07:43:03 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1d9f9262a5eee88f2d464ae18a9829a29c69bafa;p=tortuga-home.git . --- diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2373f87..a7dc4ac 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,6 +3,9 @@ + + + diff --git a/scripts/lib/ssh.php b/scripts/lib/ssh.php index a73d548..429dfd9 100644 --- a/scripts/lib/ssh.php +++ b/scripts/lib/ssh.php @@ -39,7 +39,7 @@ function getSSHInstance($device = null, $sudo = false, $force = false) function sshCommand($command, $device = null, $blocking = true, $sudo = false) { - //return sshRunCommand($command, $device, $blocking, $sudo); + return sshRunCommand($command, $device, $blocking, $sudo); $redis = connectRedis(); $queue = $redis->igbget('ssh_queue'); if (!is_array($queue)) { diff --git a/servers/insteon.php b/servers/insteon.php index ed01b5a..0bef892 100644 --- a/servers/insteon.php +++ b/servers/insteon.php @@ -10,6 +10,7 @@ ignore_user_abort(true); echo 'Run home server insteon' . "\n"; $redis = connectRedis(); +handleInsteonQueue(); redisEventListener('insteon_event', 'handleInsteonQueue'); @@ -24,11 +25,14 @@ function handleInsteonQueue() $redis->igbset('insteon_queue', $queue); } + if (!count($queue)) { echo 'Queue empty ' . "\n"; break; } + $queue = array_unique($queue); + echo 'Handle Queue : current state ' . json_encode($queue) . "\n"; $command = array_shift($queue); @@ -37,5 +41,5 @@ function handleInsteonQueue() runInsteonCommand($command); usleep(1000000 * 0.5); } - echo 'End of handling queue'."\n"; + echo 'End of handling queue' . "\n"; } \ No newline at end of file diff --git a/servers/squeezebox.php b/servers/squeezebox.php index b314280..9e8b56b 100644 --- a/servers/squeezebox.php +++ b/servers/squeezebox.php @@ -3,6 +3,8 @@ igbset($q, $queue); } if (!count($queue)) { - echo 'End processing queue' . "\n"; + echo 'End processing queue :)' . "\n"; + $processingSqueezeboxQueue = false; break; } @@ -32,5 +44,7 @@ function handleSqueezeboxQueue() $redis->igbset($q, $queue); echo 'Run command ' . json_encode($command) . "\n"; _squeezeRequest($command[0], $command[1]); + usleep(0.05 * 1000000); } + $processingSqueezeboxQueue = false; } \ No newline at end of file