Skip to content
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

Schedule between() not working as expected #50120

Closed
raveren opened this issue Feb 16, 2024 · 4 comments
Closed

Schedule between() not working as expected #50120

raveren opened this issue Feb 16, 2024 · 4 comments

Comments

@raveren
Copy link

raveren commented Feb 16, 2024

Laravel Version

10.44

PHP Version

8.1.5

Database Driver & Version

No response

Description

I wanted to convert old style cron expressions into the more readable fluent method format, but noticed that the between method when scheduling commands seems to not be doing anything.

I use the example from the docs (https://laravel.com/docs/10.x/scheduling#between-time-constraints):

        $schedule->command('emails:send')
            ->hourly()
            ->between('7:00', '22:00');

And launch php artisan schedule:list:

  0 * * * *    php artisan emails:send ......................... Next Due: in 8 Minutes

As you can see the configuration resolves itself to just hourly, is this a bug?

Steps To Reproduce

add

        $schedule->command('emails:send')
            ->hourly()
            ->between('7:00', '22:00');

to app\Console\Kernel.php and launch php artisan schedule:list

@raveren raveren changed the title Schedule between not working as expected Schedule between() not working as expected Feb 17, 2024
@driesvints
Copy link
Member

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.

Thanks!

@raveren
Copy link
Author

raveren commented Feb 19, 2024

Laracasts user s4muel reports the bug is actually in the php artisan schedule:list a PR-fix for which Taylor refused.

Should I file a bug for the artisan command?

I manually converted my projects schedules into the fluent format from the hardly readable cron, and now I have no way to check if it's the same as it was.

@wanted80
Copy link

Hello,

I have the same bug and I'm using Laravel 11.0.7 and PHP 8.3.4.

This is the output after launch php artisan schedule:list:

*/5 * * * * php artisan app:data:import ......................................Next Due: in 50 Seconds

This is the part of code in the route console configuration routes/console.php:

use App\Console\Commands\DataImport;
use Illuminate\Support\Facades\Schedule;

Schedule::command(DataImport::class)
    ->everyFiveMinutes()
    ->between('9:00', '23:59')
    ->withoutOverlapping()
    ->emailOutputOnFailure(config('site.default_notice_email'));

@raveren
Copy link
Author

raveren commented Mar 20, 2024

created explicit issue about the schedule:list #50670

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants