lib/resque/plugins/retry.rb in resque-retry-1.7.0 vs lib/resque/plugins/retry.rb in resque-retry-1.7.1
- old
+ new
@@ -133,12 +133,16 @@
#
# @return [Number] number of seconds to delay
#
# @api public
def retry_delay(exception_class = nil)
- if instance_variable_defined?(:@retry_exceptions) && @retry_exceptions.is_a?(Hash)
+ if \
+ !exception_class.nil? && \
+ instance_variable_defined?(:@retry_exceptions) && \
+ @retry_exceptions.is_a?(Hash)
delay = @retry_exceptions[exception_class] ||= begin
- relevant_definitions = @retry_exceptions.select { |ex| exception_class <= ex }
+ relevant_definitions = \
+ @retry_exceptions.select { |ex| exception_class <= ex }
relevant_definitions.any? ? relevant_definitions.sort.first[1] : 0
end
# allow an array of delays.
delay.is_a?(Array) ? delay[retry_attempt] || delay.last : delay
else