Permet de tester le scheduler en prod sans attendre le cycle de 2h : make sf c="app:monitoring:run"
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Command;
|
|
|
|
use App\Domain\Manga\Application\Command\CheckMonitoredMangas;
|
|
use Symfony\Component\Console\Attribute\AsCommand;
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Messenger\MessageBusInterface;
|
|
|
|
#[AsCommand(
|
|
name: 'app:monitoring:run',
|
|
description: 'Déclenche immédiatement la vérification des mangas monitorés (sans attendre le scheduler)',
|
|
)]
|
|
class RunMonitoringCommand extends Command
|
|
{
|
|
public function __construct(
|
|
private readonly MessageBusInterface $commandBus,
|
|
) {
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
$output->writeln('Déclenchement du monitoring des mangas...');
|
|
|
|
$this->commandBus->dispatch(new CheckMonitoredMangas());
|
|
|
|
$output->writeln('<info>Vérification lancée. Les nouveaux chapitres détectés seront scrappés via le worker commands.</info>');
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|