/**
  * {@inheritDoc}
  */
 public function statsTube($tube)
 {
     if ($this->dispatcher) {
         $this->dispatcher->dispatch(CommandEvent::STATS_TUBE, new CommandEvent($this, ['tube' => $tube]));
     }
     return $this->pheanstalk->statsTube($tube);
 }
Exemple #2
0
 public function getTubeStats()
 {
     $result = [];
     $tubes = $this->pheanstalk->listTubes();
     foreach ($tubes as $tubeName) {
         $stats = $this->pheanstalk->statsTube($tubeName);
         $result[] = ['name' => $tubeName, 'buried' => $stats['current-jobs-buried'], 'delayed' => $stats['current-jobs-delayed'], 'ready' => $stats['current-jobs-ready'], 'reserved' => $stats['current-jobs-reserved'], 'urgent' => $stats['current-jobs-urgent'], 'waiting' => $stats['current-waiting'], 'total' => $stats['total-jobs']];
     }
     return $result;
 }
 /**
  * @param string $action
  *
  * @throws Exception
  *
  * @return array
  */
 public function getActionStats($action)
 {
     try {
         return $this->pheanstalk->statsTube($action);
     } catch (Exception $exception) {
         if (false !== strpos($exception->getMessage(), 'NOT_FOUND')) {
             return null;
         }
         throw $exception;
     }
 }
 private function writeTubeStats(PheanstalkInterface $conn, $tube, OutputInterface $out)
 {
     try {
         $stats = $conn->statsTube($tube);
         $out->writeln("<info>{$tube} Stats</info>");
         $this->writeStats($stats, $out);
     } catch (ServerException $e) {
         if (false !== stripos($e->getMessage(), 'NOT_FOUND')) {
             return $out->writeln(sprintf('<error>Tube "%s" not found</error>', $tube));
         }
         throw $e;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function count($queue)
 {
     $stats = $this->pheanstalk->statsTube($queue);
     return $stats['current-jobs-ready'];
 }
 /**
  * Amount of ready jobs
  *
  * @return int
  */
 public function count()
 {
     return $this->pheanstalk->statsTube($this->tube)['current-jobs-ready'];
 }