Workers
Published
Updated
⚙️
Work through the queue.
A worker is a job that runs non-stop in the background of a fortrabbit environment, typically a queue worker. It starts again when it exits and after every deployment.
About workers
A worker runs one command non-stop, without a schedule. It waits for work, such as a new entry in a queue, and handles it right away. Crons, in contrast, start at fixed times and end. Workers are jobs of the Jobs component and run in their own container, separate from the PHP processes that answer web requests. Add them in the dashboard, see jobs usage.
Worker use cases
- Queue workers, such as
php artisan queue:workin Laravel or the Craft CMS queue - Image transforms and video processing
- Polling an external API
Moving slow tasks from the web request to a worker keeps PHP processes free for visitors, see PHP processes.
Workers and deployments
Each successful deployment restarts all workers, so they run the latest code. A worker gets the exit signal first, see graceful shutdown.