.cursor/skills/laravel-best-practices/rules/scheduling.md
withoutOverlapping() on Variable-Duration TasksWithout it, a long-running task spawns a second instance on the next tick, causing double-processing or resource exhaustion.
onOneServer() on Multi-Server DeploymentsWithout it, every server runs the same task simultaneously. Requires a shared cache driver (Redis, database, Memcached).
runInBackground() for Concurrent Long TasksBy default, tasks at the same tick run sequentially. A slow first task delays all subsequent ones. runInBackground() runs them as separate processes.
environments() to Restrict TasksPrevent accidental execution of production-only tasks (billing, reporting) on staging.
Schedule::command('billing:charge')->monthly()->environments(['production']);
takeUntilTimeout() for Time-Bounded ProcessingA task running every 15 minutes that processes an unbounded cursor can overlap with the next run. Bound execution time.
Avoid repeating ->onOneServer()->timezone('America/New_York') across many tasks.
Schedule::daily()
->onOneServer()
->timezone('America/New_York')
->group(function () {
Schedule::command('emails:send --force');
Schedule::command('emails:prune');
});