8000 [Scheduler] Tweak debug:scheduler command output by fabpot · Pull Request #49810 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Scheduler] Tweak debug:scheduler command output #49810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/Symfony/Component/Scheduler/Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* Command to list/debug schedules.
*
* @author Kevin Bond <kevinbond@gmail.com>
*
* @experimental
*/
#[AsCommand(name: 'debug:scheduler', description: 'List schedules and their recurring messages')]
final class DebugCommand extends Command
Expand Down Expand Up @@ -63,16 +65,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io = new SymfonyStyle($input, $output);
$io->title('Scheduler');

$names = $input->getArgument('schedule') ?: $this->scheduleNames;
if (!$names = $input->getArgument('schedule') ?: $this->scheduleNames) {
$io->error('No schedules found.');

return self::FAILURE;
}

foreach ($names as $name) {
$io->section($name);

/** @var ScheduleProviderInterface $schedule */
$schedule = $this->schedules->get($name);
if (!$messages = $schedule->getSchedule()->getRecurringMessages()) {
$io->warning(sprintf('No recurring messages found for schedule "%s".', $name));

$io->section($name);
continue;
}
$io->table(
['Message', 'Trigger', 'Next Run'],
array_map(self::renderRecurringMessage(...), $schedule->getSchedule()->getRecurringMessages())
array_map(self::renderRecurringMessage(...), $messages),
);
}

Expand Down
0