Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Last active September 11, 2024 09:04
Show Gist options
  • Save vielhuber/dce1dab1a3de747b1177428ab56b677c to your computer and use it in GitHub Desktop.
Save vielhuber/dce1dab1a3de747b1177428ab56b677c to your computer and use it in GitHub Desktop.
jobs queues #laravel

on every code change, don't forget to restart

  • php artisan queue:restart

production (normally used with supervisor)

  • php artisan queue:work --sleep=3 --tries=1 --memory=768 --timeout=10800

test queue locally

  • php artisan queue:work --env=production --sleep=3 --tries=1 --memory=768 --timeout=3600
  • php artisan queue:listen --env=production --sleep=3 --tries=1 --memory=768 --timeout=3600 # does not need restarts, but is less more efficient

get queue size

\Illuminate\Support\Facades\Queue::size();
SELECT COUNT(*) FROM jobs

clear queue

  • php artisan queue:clear

use named queues

  • ExampleQueue::dispatch()->onQueue('queue_name');
  • php artisan queue:work --queue=queue_name
  • Queue::size('queue_name')
  • php artisan queue:clear --queue=queue_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment