tarantool-php /
jobqueue
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Tarantool\JobQueue\Console\Command; |
||
| 4 | |||
| 5 | use Symfony\Component\Console\Input\InputArgument; |
||
| 6 | use Symfony\Component\Console\Input\InputInterface; |
||
| 7 | use Symfony\Component\Console\Output\OutputInterface; |
||
| 8 | |||
| 9 | class KickCommand extends Command |
||
| 10 | { |
||
| 11 | protected function configure(): void |
||
| 12 | { |
||
| 13 | parent::configure(); |
||
| 14 | |||
| 15 | $this |
||
| 16 | ->setName('kick') |
||
| 17 | ->setDescription('Kicks buried tasks back to the queue') |
||
| 18 | ->addArgument('count', InputArgument::REQUIRED) |
||
| 19 | ; |
||
| 20 | } |
||
| 21 | |||
| 22 | protected function execute(InputInterface $input, OutputInterface $output): void |
||
| 23 | { |
||
| 24 | $queue = $this->createConfigFactory($input, $output)->createQueue(); |
||
| 25 | $count = $input->getArgument('count'); |
||
| 26 | |||
| 27 | $affected = $queue->kick($count); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 28 | |||
| 29 | $output->writeln(sprintf( |
||
| 30 | '<comment>%d</comment> tasks were successfully kicked back to <info>%s</info>.', |
||
| 31 | $affected, |
||
| 32 | $queue->getName() |
||
| 33 | )); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |