25 lines
1.0 KiB
Markdown
25 lines
1.0 KiB
Markdown
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:
|
|
|
|
```bash
|
|
./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:
|
|
|
|
```cron
|
|
* * * * * cd /path/to/project && ./vendor/bin/sail artisan schedule:run >> /dev/null 2>&1
|
|
```
|
|
|
|
Notes
|
|
|
|
- On production, prefer running `schedule:run` from a system cron or a host scheduler. If you run inside Docker, use a dedicated scheduler container or the `schedule:work` command.
|
|
- The scheduled task will call the `reservations:expire` command which marks held reservations as `expired` when their `reserved_until` is in the past.
|