Search code examples
phpmacoslaravelqueuebeanstalkd

beanstalkd default wal directory


We are using Laravel with BeansTalkD for queuing in our app. Now I am stuck at a point that this command :

php artisan queue:listen

keeps getting jobs, in other words there are a lot of jobs and I have no idea how to clean the queue.

And the problem is that I ran the beanstalkd using this command:

beanstalkd -z 1024*1024

which does not specify wal directory.

I have been searching for the whole last week on how to clean beanstalk work queue, but found nothing.

Tips

  • I am running this on Mac OS X Yosemite.
  • Restarting BeansTalkD service did not solve it
  • I don't store jobs in DB so flush command is not the one. (I don't know if Laravel does that with me knowing but I don't think so)
  • I am deleting the jobs when I am done but the app generates a lot of jobs.

Solution

  • If you didn't use -b option then restarting beanstalkd (again without -b) should help.

    Now if restarting for some reason doesn't work for you and you're using Laravel 5.x you can consider installing artisan-beans package and use php artisan beans:purge command to clean up your queue.


    UPDATE: Since you're on Laravel 4.2 you can

    1. install dependency-free CLI tool beanstool. Here's how install v2.0 on OS X

      wget https://github.com/tyba/beanstool/releases/download/v0.2.0/beanstool_v0.2.0_darwin_amd64.tar.gz
      tar -xvzf beanstool_v0.2.0_darwin_amd64.tar.gz
      cp beanstool_v0.2.0_darwin_amd64/beanstool /usr/local/bin/
      
    2. and then run this in bash

      for i in {1..N}; do beanstool delete -t default --state=ready; done
      

      Change N to the number of jobs you want to delete at once and default to the name of your queue (tube).

      If you wonder how many jobs you currently have in the queue run

      beanstool stats