Horizon: Clear all jobs of one queue

Created on 25 Apr 2018  ·  21Comments  ·  Source: laravel/horizon

Hi,

In beanstalk there is some button "Delete all ready jobs" is there in horizon also a button for that action?

enhancement

Most helpful comment

@dillingham what a diligent user, clicking that button 90k times 😆

All 21 comments

You can create a command that executes code like:

use Redis;

Redis::connection()->del('queues:queue-name');

And it will clear that queue's jobs (which are ready/have not yet been run).

Can you give a real life example ?because this doesn't seem to give me any effect.

Also dell seems to accept array type values not string.

Update: Solved my issue - turns out my redis connection is called 'horizon' . So Redis::connection('horizon')->del('queues:queue-name'): works as expected :+1:

Yeah, but its better that i can do this in Horizon self! 👍

@tomswinkels Fully agree - that would be a great improvement !

yup! would be cool to clear the queue via interface! +1

@taylorotwell :-) ?

I'll mark this as a feature request for now. Would be open to PRs which would implement this in a nice and clean way.

Ideally the functionality is available in Laravel but Horizon can expose an UI for that…

Currently looking for this now
I have 90k jobs that are false due to a user clicking a import button too many times.

@dillingham what a diligent user, clicking that button 90k times 😆

Any news about when this feature will be added to horizon???

@andreladocruz as soon as someone sends in a pr

@neorganic, do you know how to run it in tinker?

thanks...

do you know how to run the command

Redis::connection('horizon')->del('queues:queue-name')

in tinker?

@andreladocruz as soon as someone sends in a pr

@parkourben99 thnx for creating a pr :)

Since Taylor rejected the PR we're probably not going to implement this anytime soon, sorry. Anyone's free to do another attempt of the related PR which solves all the things that still need to be taken care of.

I'm using this command for clearing queue.

use Illuminate\Support\Facades\Redis;
Redis::connection()->del('queues:queue-name');

Unfortunately it's not removing delayed jobs.

Anyone have any clue about this.

Update:
This command removed my delayed jobs
Redis::connection()->del('queues:queue-name:delayed');

I'm using this command for clearing queue.

use Illuminate\Support\Facades\Redis;
Redis::connection()->del('queues:queue-name');

Unfortunately it's not removing delayed jobs.

Anyone have any clue about this.

Update:
This command removed my delayed jobs
Redis::connection()->del('queues:queue-name:delayed');

Hi, does that remove the complete jobs too? I have the version of Laravel 7.
image

I had to give id explicitly like so:

\Redis::connection('horizon')->del('queues:my-queue:delayed', 39);

Was this page helpful?
0 / 5 - 0 ratings