lib/resque/failure/redis.rb in mongo-resque-1.17.1 vs lib/resque/failure/redis.rb in mongo-resque-1.18.2

- old
+ new

@@ -3,15 +3,15 @@ # A Failure backend that stores exceptions in Mongo. Very simple but # works out of the box, along with support in the Resque web app. class Redis < Base def save data = { - :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S"), + :failed_at => Time.now.strftime("%Y/%m/%d %H:%M:%S %Z"), :payload => payload, :exception => exception.class.to_s, :error => exception.to_s, - :backtrace => Array(exception.backtrace), + :backtrace => filter_backtrace(Array(exception.backtrace)), :worker => worker.to_s, :queue => queue } Resque.mongo_failures << data end @@ -38,9 +38,14 @@ def self.remove(index) id = rand(0xffffff) Resque.redis.lset(:failed, index, id) Resque.redis.lrem(:failed, 1, id) + end + + def filter_backtrace(backtrace) + index = backtrace.index { |item| item.include?('/lib/resque/job.rb') } + backtrace.first(index.to_i) end end end end