Skip to content

Commit d1cfe4d

Browse files
zr40defunkt
authored andcommitted
Shorten the backtrace logged by Resque::Failure::Redis to only include the job by removing Resque and its callers (like Rake) from the backtrace.
1 parent 0a39370 commit d1cfe4d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/resque/failure/redis.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def save
99
:payload => payload,
1010
:exception => exception.class.to_s,
1111
:error => exception.to_s,
12-
:backtrace => Array(exception.backtrace),
12+
:backtrace => filter_backtrace(Array(exception.backtrace)),
1313
:worker => worker.to_s,
1414
:queue => queue
1515
}
@@ -41,6 +41,10 @@ def self.remove(index)
4141
Resque.redis.lset(:failed, index, id)
4242
Resque.redis.lrem(:failed, 1, id)
4343
end
44+
45+
def filter_backtrace(backtrace)
46+
backtrace.first(backtrace.index {|item| item.include?('/lib/resque/job.rb')})
47+
end
4448
end
4549
end
4650
end

0 commit comments

Comments
 (0)