laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.87k stars 657 forks source link

Clear all jobs of one queue #328

Closed tomswinkels closed 4 years ago

tomswinkels commented 6 years ago

Hi,

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

bryceadams commented 6 years ago

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).

mkantautas commented 6 years ago

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:

tomswinkels commented 6 years ago

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

mkantautas commented 6 years ago

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

divdax commented 6 years ago

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

tomswinkels commented 6 years ago

@taylorotwell :-) ?

vmosoti commented 6 years ago

Try using this package: https://github.com/morrislaptop/laravel-queue-clear

driesvints commented 6 years ago

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.

mfn commented 6 years ago

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

dillingham commented 5 years ago

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

ronlobo commented 5 years ago

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

dmitryuk commented 5 years ago

https://github.com/RoboFinance/laravel-redis-queue-clear

andreladocruz commented 4 years ago

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

driesvints commented 4 years ago

@andreladocruz as soon as someone sends in a pr

andreladocruz commented 4 years ago

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

andreladocruz commented 4 years ago

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

tomswinkels commented 4 years ago

@parkourben99 thnx for creating a pr :)

driesvints commented 4 years ago

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.

rana01645 commented 4 years ago

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');

garbinmarcelo commented 4 years ago

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

sentiasa commented 4 years ago

I had to give id explicitly like so:

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

marcosdsdba commented 3 years ago

to cleaning all failed and completed : Open redis-cli (my redis not using default port)

redis-cli

127.0.0.1:6378> FLUSHDB

if u uses password: 127.0.0.1:6379> auth your_secret_here

after: 127.0.0.1:6378> FLUSHDB