From 091d88bc335efb945bb11fb338b16cbac407ac70 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Wed, 18 Apr 2012 20:13:10 -0700 Subject: [PATCH] Various cleanups --- Changes.md | 4 +++- lib/sidekiq/fetch.rb | 4 ++-- lib/sidekiq/version.rb | 2 +- lib/sidekiq/worker.rb | 7 +------ 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Changes.md b/Changes.md index 0e2b51db..9c7cc73f 100644 --- a/Changes.md +++ b/Changes.md @@ -1,7 +1,9 @@ HEAD ----------- -- Gracefully rescue any errors thrown in the Fetcher and sleep for 1 second before retrying. +- Better network error handling when fetching jobs from Redis. + Sidekiq will retry once per second until it can re-establish + a connection. 1.1.2 ----------- diff --git a/lib/sidekiq/fetch.rb b/lib/sidekiq/fetch.rb index ffedd7f0..cade3f43 100644 --- a/lib/sidekiq/fetch.rb +++ b/lib/sidekiq/fetch.rb @@ -39,8 +39,8 @@ module Sidekiq after(0) { fetch } end rescue => ex - logger.error("Error while fetching messages: #{ex}") - logger.error(ex.backtrace.join("\n")) + logger.error("Error fetching message: #{ex}") + logger.error(ex.backtrace.first) sleep(TIMEOUT) after(0) { fetch } end diff --git a/lib/sidekiq/version.rb b/lib/sidekiq/version.rb index ab42a8c2..01a29f1e 100644 --- a/lib/sidekiq/version.rb +++ b/lib/sidekiq/version.rb @@ -1,3 +1,3 @@ module Sidekiq - VERSION = "1.1.2" + VERSION = "1.1.3" end diff --git a/lib/sidekiq/worker.rb b/lib/sidekiq/worker.rb index 61408163..c3cdf6c5 100644 --- a/lib/sidekiq/worker.rb +++ b/lib/sidekiq/worker.rb @@ -29,11 +29,6 @@ module Sidekiq Sidekiq::Client.push('class' => self, 'args' => args) end - def queue(name) - puts "DEPRECATED: `queue :name` is now `sidekiq_options :queue => :name`" - Sidekiq::Client.queue_mappings[self.name] = name.to_s - end - ## # Allows customization for this type of Worker. # Legal options: @@ -46,7 +41,7 @@ module Sidekiq end def get_sidekiq_options # :nodoc: - @sidekiq_options || { 'unique' => true, 'retry' => true, 'queue' => 'default' } + defined?(@sidekiq_options) ? @sidekiq_options : { 'unique' => true, 'retry' => true, 'queue' => 'default' } end def stringify_keys(hash) # :nodoc: