|
@@ -159,7 +159,6 @@ class FindBoxService
|
|
|
$jobs = [];
|
|
$jobs = [];
|
|
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
|
-
|
|
|
|
|
$this->getCurrentQueue();
|
|
$this->getCurrentQueue();
|
|
|
|
|
|
|
|
foreach($this->labelToBlink as $commandID => &$label) {
|
|
foreach($this->labelToBlink as $commandID => &$label) {
|
|
@@ -199,7 +198,6 @@ class FindBoxService
|
|
|
|
|
|
|
|
// Response RESTful ricevuta da Findbox Core?
|
|
// Response RESTful ricevuta da Findbox Core?
|
|
|
if (is_array($err)) {
|
|
if (is_array($err)) {
|
|
|
-
|
|
|
|
|
if ($this->ManageBlinkFaults($asyncBlink, $asyncBlink->getLabels(), $err)) {
|
|
if ($this->ManageBlinkFaults($asyncBlink, $asyncBlink->getLabels(), $err)) {
|
|
|
// Remove the JOB
|
|
// Remove the JOB
|
|
|
unset($jobs[$commandID]);
|
|
unset($jobs[$commandID]);
|
|
@@ -233,7 +231,12 @@ class FindBoxService
|
|
|
break;
|
|
break;
|
|
|
case QueueCommand::$Q_BLINK_ON:
|
|
case QueueCommand::$Q_BLINK_ON:
|
|
|
case QueueCommand::$Q_BLINK_OFF:
|
|
case QueueCommand::$Q_BLINK_OFF:
|
|
|
- $this->labelToBlink[rand(0, 60000)] = $qCommand;
|
|
|
|
|
|
|
+ $labelsSplitted = array_chunk($qCommand->id, 9);
|
|
|
|
|
+ foreach($labelsSplitted as $labels) {
|
|
|
|
|
+ $cmd = clone $qCommand;
|
|
|
|
|
+ $cmd->id = $labels;
|
|
|
|
|
+ $this->labelToBlink[rand(0, 60000)] = $cmd;
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
case QueueCommand::$Q_DISPLAY:
|
|
case QueueCommand::$Q_DISPLAY:
|
|
|
$this->ServiceLogger->write("Change display for label {$qCommand->id} requested", 'd/m/Y H:i:s');
|
|
$this->ServiceLogger->write("Change display for label {$qCommand->id} requested", 'd/m/Y H:i:s');
|
|
@@ -269,6 +272,12 @@ class FindBoxService
|
|
|
private function ManageBlinkFaults(AsyncJobClass &$job, array $labels, $fbError): bool
|
|
private function ManageBlinkFaults(AsyncJobClass &$job, array $labels, $fbError): bool
|
|
|
{
|
|
{
|
|
|
$labelResponses = $this->findBoxCore->getLabelsFromResponse($fbError);
|
|
$labelResponses = $this->findBoxCore->getLabelsFromResponse($fbError);
|
|
|
|
|
+ if ($labelResponses === NULL) {
|
|
|
|
|
+ $labelJ = join(', ', $labels);
|
|
|
|
|
+ $this->ServiceLogger->write("Label(s) {$labelJ} error removed from queue: {$fbError['value']['value']}", 'd/m/Y H:i:s');
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Filter labels with errors
|
|
// Filter labels with errors
|
|
|
$fail = array_filter($labelResponses, function ($v) {
|
|
$fail = array_filter($labelResponses, function ($v) {
|
|
|
return !$v;
|
|
return !$v;
|