Operations
Workers and scheduled tasks
Run supervised queues and billing reconciliation with the correct environment.
On this page
What needs a worker?#
Watched-discussion email and optional access notifications use queued jobs. Verification/password reset and the deliberate administrator delivery test still use the configured mail transport directly. Billing canonical reconciliation also uses the queue.
Web and worker must share the same database, APP_KEY, mail/billing variables, QUEUE_CONNECTION=database and shared CACHE_STORE=database. Configure migrations before starting the worker. Use a process supervisor that restarts it after exits.
Generic host command#
php artisan queue:work database --queue=default --sleep=3 --tries=3 --backoff=60 --timeout=60 --max-time=3600 --memory=128
Keep the 60-second timeout below the documented 90-second retry interval. Linux CLI needs pcntl. Allow at least 70 seconds for graceful shutdown. Run php artisan queue:restart after new code/environment deployment and confirm the supervisor starts the new process.
Billing schedule#
If using payments, supervise sh deploy/billing-scheduler.sh or run php artisan billing:enqueue every minute through your host scheduler. Sources become eligible every 15 minutes, with a fair batch limit. On Railway the supplied worker script supervises queue and billing scheduling together; a separate schedule:work is not required.
Diagnose delivery#
Inspect worker logs and php artisan queue:failed. Fix the underlying configuration/provider issue before selectively retrying a failed ID with php artisan queue:retry <id>. Delivery is at least once: a crash after provider acceptance can cause a duplicate.
Use two local or controlled test accounts: opt one into a visible watched discussion, post a reply with the other, confirm the completed job and inbox receipt, then test unsubscribe and opted-out behavior. A healthy homepage or empty failed-job list alone does not prove delivery.
Railway specifics#
Follow the worker reference for web/worker service settings, environment sharing, migration ownership and shutdown policy. A worker has no public domain or HTTP health check. Confirm every service runs the intended commit after a release.