module Resque::Plugins::ResqueCleaner::FailedJobEx
Exntends job(Hash instance) with some helper methods.
Public Instance Methods
after?(time)
click to toggle source
Returns true if the job processed(failed) after the given time. Otherwise returns false. You can pass Time object or String.
# File lib/resque_cleaner.rb, line 176 def after?(time) time = Time.parse(time) if time.is_a?(String) Time.parse(self['failed_at']) >= time end
before?(time)
click to toggle source
Returns true if the job processed(failed) before the given time. Otherwise returns false. You can pass Time object or String.
# File lib/resque_cleaner.rb, line 168 def before?(time) time = Time.parse(time) if time.is_a?(String) Time.parse(self['failed_at']) < time end
exception?(exception)
click to toggle source
Returns true if the exception raised by the failed job matches. Otherwise returns false.
# File lib/resque_cleaner.rb, line 191 def exception?(exception) self["exception"] == exception.to_s end
klass?(klass_or_name)
click to toggle source
Returns true if the class of the job matches. Otherwise returns false.
# File lib/resque_cleaner.rb, line 182 def klass?(klass_or_name) if self["payload"] && self["payload"]["class"] self["payload"]["class"] == klass_or_name.to_s else klass_or_name=="UNKNOWN" end end
queue?(queue)
click to toggle source
Returns true if the queue of the job matches. Otherwise returns false.
# File lib/resque_cleaner.rb, line 196 def queue?(queue) self["queue"] == queue.to_s end
retried?()
click to toggle source
Returns true if the job has been already retried. Otherwise returns false.
# File lib/resque_cleaner.rb, line 160 def retried? !self['retried_at'].nil? end
Also aliased as: requeued?