-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Cron task for Laravel schedule with sub-minute repeating skip a next minute running #49488
Comments
Hey there, thanks for reporting this issue. We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue. Thanks! |
Hi! I make repository to reproduce bug in one command. (This is clear laravel installation with only one added queued TestJob) How to Start
Where to Find the IssueAfter launching the Docker containers, the Laravel application will start, and a test queued job will be executed in the schedule. All logs are located in the standard Laravel logs folder:
A portion of these logs is also available in the repository for easy access without the need to run the application. Important noteIn Date::now()->lte($this->startedAt->endOfMinute()) to Date::now()->lte($this->startedAt->endOfMinute()->subSeconds(20)) It works perfect... I was unable to identify why cron skips running the |
@alexsmirnovdotcom I also had a similar issue where sub-minute tasks sometime gets skipped. I solved it by running a task to schedule the jobs to be run in the future. In your case, it would be something like: $schedule->call(function () {
$now = now()->floorMinute()->toImmutable();
for ($i = 0; $i < 6; ++$i) {
$dispatchTime = $now->addSeconds($i * 10);
dispatch(new SyncChangesFrom1C)->delay($dispatchTime);
}
})->everyMinute()->name('ScheduleSyncChangesFrom1CJobs'); Hope this helps. |
Laravel Version
10.4.1
PHP Version
8.2
Database Driver & Version
No response
Description
In last versions of laravel 10 was added sub-minute intervals.
But i have strange behavior of runnig of cron task.
All works in Docker with docker-compose.
Cron works in separate from Laravel container.
I have no any errors in logs.
Crontab file:
\App\Console\Kernel.php:
SyncChangesFrom1C is a queued job.
handle
method is empty.Logs of Laravel:
Logs of Cron:
If i`m change to everyMinute:
It work perfect, and run every minute.
Why it skip a minute before new run if used sub-minutes interval?
Steps To Reproduce
The text was updated successfully, but these errors were encountered: