Rails uninitialized constant Resque::Server

One of the most significant changes in my migration of a rails app from Rails 2.3.10 to rails 3.0.9 was the move from delayed_jobs to Resque.

Resque is a Queue system that’s based on Redis, which is much faster and reduces the load on your database. Also we were experiencing some nasty deadlocks with delayed jobs that really broke our transactions and our backs.

I installed the gem and installed Redis on my development machine, mounted the Sinatra app on my rails app and navigated to the web view of resque.

Then, I saw this error:

	RuntimeError at /resque/overview
	ERR unknown command 'server'
	file: client.rb location: call line: 47

Which looked like that:

Resque server error

After doing some digging into the code (as I always do when I encountered a problem with a gem), I found that the version of the gem (resque) I was using called the “server” method on the redis instance which was not there any more.

Looking at the code for the new gem showed that the app is now using the property “redis_id” which looks like this:

	def redis_id
	  # support 1.x versions of redis-rb
	  if redis.respond_to?(:server)
	    elsif redis.respond_to?(:nodes) # distributed
	      redis.nodes.map { |n| n.id }.join(', ')

Upgrading the gem to the newest version solved my problem and everything got back to normal. So, if you encounter this issue, just upgrade the resque gem and you are all good.

The gem version I was using was “resque (1.8.2)”, now I am using “resque (1.18.2)”

As always, if this post was helpful, drop me a comment, I would love to hear.

<img src="http://feeds.feedburner.com/~r/KensoDev-en/~4/b9Zi-PVpXrs" height="1" width="1"/>
Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com