Friday, January 27, 2012

resque and WildCard usage

While testing we were starting resque workers as
 rake resque:work QUEUE=* 
this used to start the workers listening on all the Resque's queues and never exit.

So hoping Resque understands wildcards well, we made
 rake resque:work QUEUE=q01.* 
a part of our automated configuration tasks to start all our queues within Resque's queue starting with name q01 like q01.rss and q01.atom.

These queues were getting started fine and displayed well on Resque's WebUI.
But on scheduling a task for these queues, the worker started with q01.* wasn't able to pick up the queued task for neither q01.rss nor q01.atom.

Investigating the Resque codebase the understanding we developed was just plain '*' is separately handled out to return entire array of all available queues and is acted upon. But it doesn't handle Wildcards.

So, we started it as
 rake resque:work QUEUE=q01.rss 
rake resque:work QUEUE=q01.atom
and it worked fine.

Don't do the same mistake.

if you don't already know what is redis and resque:

Resque : a famous opensource ruby library to create background workers on multiple queues and processing them when any task is available
Redis : it's a popular opensource project for in-memory key value data-store 
(why were you reading then actually)

No comments:

Post a Comment