Пример #1
0
 protected function doExpire()
 {
     if ($this->expiring->isEmpty()) {
         return;
     }
     $now = $this->getTimestamp();
     foreach ($this->expiring as $key => $time) {
         if ($now >= $time) {
             unset($this->expiring[$key]);
             unset($this->data[$key]);
         }
     }
 }
Пример #2
0
 /**
  * @param TubeStats[]|ArrayCollection $stats
  * @param int|null                    $width
  * @return string
  */
 private function renderStats(ArrayCollection $stats, $width = null)
 {
     if ($stats->isEmpty()) {
         return 'There are no current tubes';
     }
     $buffer = new BufferedOutput();
     $buffer->setDecorated(true);
     $width = $width ?: $this->getConsoleWidth();
     $table = $width ? new AutoHidingTable($buffer, $width) : new Table($buffer);
     $table->setHeaders(array('Tube', 'Ready', 'Buried', 'Reserved', 'Delayed', 'Urgent', 'Total', '', 'Using', 'Watching', 'Waiting', '', 'Pause Elapsed', 'Pause Left', '', 'Delete Count', 'Pause Count'));
     foreach ($stats as $tubeStats) {
         $table->addRow(array($tubeStats->name(), $tubeStats->readyJobs(), $tubeStats->buriedJobs(), $tubeStats->reservedJobs(), $tubeStats->delayedJobs(), $tubeStats->urgentJobs(), $tubeStats->totalJobs(), '', $tubeStats->usingCount(), $tubeStats->watchingCount(), $tubeStats->waitingCount(), '', $tubeStats->pause(), $tubeStats->pauseTimeLeft(), '', $tubeStats->cmdDeleteCount(), $tubeStats->cmdPauseTubeCount()));
     }
     $table->render();
     return $buffer->fetch();
 }
Пример #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $queue = $this->getQueue();
     $stats = new ArrayCollection();
     foreach ($input->getArgument('id') as $id) {
         $jobStats = $queue->statsJob($id);
         if ($jobStats->id() !== -1) {
             $stats->add($jobStats);
         } else {
             $output->writeln("Job <info>#{$id}</info> does not exist");
         }
     }
     if (!$stats->isEmpty()) {
         $output->writeln($this->renderStats($stats));
     }
 }