Find specific job in resque queue Find specific job in resque queue ruby ruby

Find specific job in resque queue


Give resque-status a try. It is an extension to Resque that adds job tracking.

resque-status provides a set of simple classes that extend resque’s default functionality (with 0% monkey patching) to give apps a way to track specific job instances and their status. It achieves this by giving job instances UUID’s and allowing the job instances to report their status from within their iterations.

Note: d11wtq mentioned this above as a comment, but is actually the best answer so far.


Instead of querying resque queue, you should store image meta-data along with your model.

Lets assume you are storing product images. You are likely using a Redis hash to store product details. Just add another flag like this -

hset product:123 is_resizing true

You can them perform a simple lookup to show the resizing image icon. At the end of your resque job, delete the is_resizing key, and add the resized_image_url key.


I think the easiest way might be to use a redis set to cache this information.

When you add an image to the 'resize' queue, also add the image id to the 'resize_in_progress' set using SADD. (I assume you have some kind of unique key or name to refer to the image, even if not stored in the db. Maybe the full path to the filename.)

In the 'resize' process, as one of the final actions after successfully resizing the image, remove it from the set using the SREM command.

When you want a list of all images, you can fetch that with SMEMBERS. If you want just the members for a specific model id, you might need to store a separate set for each model, named something like 'resize_in_progress_3451' where 3451 is the id of the model that has the images being resized.

See http://redis.io/commands#set for more set commands.