First of all, I'm not sure if this is a issue with a when() function or a group() function but it happens after schedule group() comes after a when().
Consider this piece of code:
Schedule::daily()
->group(static function (ConsoleSchedule $schedule): void {
$schedule->when(static fn (): bool => true)
->group(static function (ConsoleSchedule $schedule): void {
// Schedule definitions under "when" condition
});
// Other daily schedule definitions
});
All schedules should have the same cron expression (0 0 * * *) but, as it turns out, the inner group under when condition has a cron expression which triggers on every minute (* * * * *) and the outer group has the right one.
Something happens with the when -> group combo with cron definitions.
Steps To Reproduce
<?php
// routes/console.php
use Illuminate\Support\Facades\Schedule;
use Illuminate\Console\Scheduling\Schedule as ConsoleSchedule;
Schedule::onOneServer()
->runInBackground()
->withoutOverlapping()
->group(static function (ConsoleSchedule $schedule): void {
// DAILY
$schedule->daily()
->group(static function (ConsoleSchedule $schedule): void {
$schedule->when(static fn (): bool => true)
->group(static function (ConsoleSchedule $schedule): void {
// Schedule definitions under "when" condition
});
// Other daily schedule definitions
});
});
Laravel Version
11.33.2
PHP Version
8.3
Database Driver & Version
No response
Description
First of all, I'm not sure if this is a issue with a
when()
function or agroup()
function but it happens after schedulegroup()
comes after awhen()
.Consider this piece of code:
All schedules should have the same cron expression (
0 0 * * *
) but, as it turns out, the inner group underwhen
condition has a cron expression which triggers on every minute (* * * * *
) and the outer group has the right one.Something happens with the
when -> group
combo with cron definitions.Steps To Reproduce