que-rb / que

A Ruby job queue that uses PostgreSQL's advisory locks for speed and reliability.
MIT License
2.31k stars 191 forks source link

Completely flush Que (0.14.3) #258

Closed Tinusw closed 4 years ago

Tinusw commented 5 years ago

Basically I've got a situation where I need to:

My problem is that I am running Que in async mode in the same thread as puma, making it impossible for me to kill Que completely.

Is there anyway I can do this in the console?

Que::Worker.workers.each(&:stop)
Que.clear!
QueJob.count
# I expect QueJob.count to return 0
# Some way to flush que historic jobs completely?

Any help would be greatly appreciated

Tinus

kofronpi commented 5 years ago

@Tinusw QueJob.delete_all ?

siegy22 commented 4 years ago

If you're running queue inside a puma thread or worker, you would have to shutdown the main thread of puma to completly shut it down. And have you tried the statement from @kofronpi?

Tinusw commented 4 years ago

Thank you all for the info!

@kofronpi saved the day.