/** * Fetch the status from the queue database and put data in an array the different output functions can use. * * @return array Keyed array of metrics we want from the queue. */ private function getStatus() { $info['queue_size'] = $this->QueuedTask->getPending(); $lastTask = $this->QueuedTask->getLastCompleted(); if (!empty($lastTask)) { $info['last_task_completed'] = $lastTask['QueuedTask']['completed']; } else { $info['last_task_completed'] = null; } $info['status'] = 'good'; if ($info['queue_size'] > self::ALERT_SIZE) { $info['status'] = 'bad'; } return $info; }