1.0 KiB
1.0 KiB
Scheduler: running reservations:expire
We added reservations:expire as an Artisan command and scheduled it to run every minute via App\Providers\SchedulerServiceProvider.
How to run the scheduler
- Recommended (development with Sail): run the long-running scheduler worker inside Sail:
./vendor/bin/sail artisan schedule:work
This will run scheduled tasks in the foreground. To run in background with Sail, open a separate terminal and start it with --detach or use your terminal multiplexer.
- Alternative (host cron): add an entry to crontab on the host that triggers Laravel's scheduler every minute:
* * * * * cd /path/to/project && ./vendor/bin/sail artisan schedule:run >> /dev/null 2>&1
Notes
- On production, prefer running
schedule:runfrom a system cron or a host scheduler. If you run inside Docker, use a dedicated scheduler container or theschedule:workcommand. - The scheduled task will call the
reservations:expirecommand which marks held reservations asexpiredwhen theirreserved_untilis in the past.