Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resque.. how can I get a list of the queues

Ok.. On heroku I have up 24 workers (as I understand it) I have say 1000 clients. Each with their own "schema" in a postgresql database.

each client has tasks that can be done "later".. sending orders to my companies back end, is a great example.

I was thinking that I could create a new queue for each client, and each queue would have it's own worker(process). That it seems isn't in the cards.

So ok.. my thinking now is to have a queue field in client record.. so client 1 through 15 are in queue_a and client 16 through 106 are in queue_b.. ect If one client is using heaps, we could move them to a new queue, or move others out of the slow Queue. clients with low volumns could be collected.. It would be a balancing act, but it wouldn't be all that hard to manage, if we kept track of metrics (which we will anyway)

(any counter ideas would be awesome to hear, I'm really in spit ball phase)

Right now, though. I'd like to figure out how to create a worker for each queue. https://gist.github.com/486161 tells me how to create X workers, but doesn't really let me set a worker to a Queue. If I knew that, and how to get a list of queues, I think I'd be on my way to a viable solution to the limits.


Reading on
http://blog.winfieldpeterson.com/2012/02/17/resque-queue-priority/
I realize that my plan is fraught with hardship.. The first client/queue to get added to the worker, would get priority.. I don't want that, I'd want them to all have the same. As long as they are part of the same queue..
like image 454
baash05 Avatar asked Dec 10 '22 02:12

baash05


1 Answers

i just stick to the topic :)

getting all queues in resque is pretty easy

Resque.queues

is a list of all queue names, it does not include the 'failed' queue, i did something like this

(['failed'] + Resque.queues).each do |queue|
  queue_size = queue=='failed' ? Resque::Failure.count : Resque.size(queue)
end
like image 157
beanie Avatar answered Dec 25 '22 11:12

beanie