Esempio n. 1
0
 protected function forEachTube(Tube $tube, InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption('ready')) {
         $job = $tube->peekReady();
         $this->outputJob($output, $job, $tube, 'ready');
     }
     if ($input->getOption('buried')) {
         $job = $tube->peekBuried();
         $this->outputJob($output, $job, $tube, 'buried');
     }
     if ($input->getOption('delayed')) {
         $job = $tube->peekDelayed();
         $this->outputJob($output, $job, $tube, 'delayed');
     }
 }
Esempio n. 2
0
 protected function forEachTube(Tube $tube, InputInterface $input, OutputInterface $output)
 {
     $number = intval($input->getOption('number'));
     if ($input->getOption('ready')) {
         $num = $tube->deleteReadyJobs($number);
         $output->writeln("Deleted <info>{$num} ready</info> jobs in <info>{$tube}</info>");
     }
     if ($input->getOption('buried')) {
         $num = $tube->deleteBuriedJobs($number);
         $output->writeln("Deleted <info>{$num} buried</info> jobs in <info>{$tube}</info>");
     }
     if ($input->getOption('delayed')) {
         $num = $tube->deleteDelayedJobs($number);
         $output->writeln("Deleted <info>{$num} delayed</info> jobs in <info>{$tube}</info>");
     }
 }
Esempio n. 3
0
 protected function forEachTube(Tube $tube, InputInterface $input, OutputInterface $output)
 {
     $number = intval($input->getOption('number'));
     $numberBuried = 0;
     do {
         $job = $tube->reserve(2);
         if ($job instanceof NullJob) {
             break;
         }
         $job->bury();
         $numberBuried++;
     } while (--$number !== 0);
     if ($numberBuried === 0) {
         return;
     }
     $output->writeln("Buried <info>{$numberBuried}</info> job" . ($numberBuried > 1 ? 's' : '') . " in <info>{$tube}</info>");
 }
Esempio n. 4
0
 public function __construct($name, TubeControlInterface $queue)
 {
     parent::__construct($name, $queue);
     $this->ready = new JobCollection();
     $this->reserved = new JobCollection();
     $this->delayed = new JobCollection();
     $this->buried = new JobCollection();
     $this->pauseTime = new Carbon();
 }
Esempio n. 5
0
 protected function forEachTube(Tube $tube, InputInterface $input, OutputInterface $output)
 {
     $delay = intval($input->getArgument('delay'));
     $tube->pause($delay);
 }
Esempio n. 6
0
 protected function forEachTube(Tube $tube, InputInterface $input, OutputInterface $output)
 {
     $number = intval($input->getOption('number'));
     $kicked = $tube->kick($number);
     $output->writeln("Kicked <info>{$kicked}</info> jobs in <info>{$tube}</info>");
 }