Module: ResqueWeb::FailuresHelper
- Defined in:
- app/helpers/resque_web/failures_helper.rb
Instance Method Summary collapse
- #each_failure(&block) ⇒ Object
- #failure_class_counts(queue = params[:id]) ⇒ Object
- #failure_date_format ⇒ Object
- #failure_end_at ⇒ Object
- #failure_per_page ⇒ Object
- #failure_queue ⇒ Object
- #failure_queue_name ⇒ Object
- #failure_size ⇒ Object
- #failure_start_at ⇒ Object
- #job_arguments(job) ⇒ Object
- #multiple_failure_queues? ⇒ Boolean
Instance Method Details
#each_failure(&block) ⇒ Object
3 4 5 |
# File 'app/helpers/resque_web/failures_helper.rb', line 3 def each_failure(&block) Resque::Failure.each(failure_start_at, failure_per_page, params[:queue], params[:class], &block) end |
#failure_class_counts(queue = params[:id]) ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/helpers/resque_web/failures_helper.rb', line 43 def failure_class_counts(queue = params[:id]) classes = Hash.new(0) Resque::Failure.each(0, Resque::Failure.count(queue), queue) do |_, item| class_name = item['payload']['class'] if item['payload'] class_name ||= "nil" classes[class_name] += 1 end classes.sort_by { |name,_| name } end |
#failure_date_format ⇒ Object
7 8 9 |
# File 'app/helpers/resque_web/failures_helper.rb', line 7 def failure_date_format "%Y/%m/%d %T %z" end |
#failure_end_at ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/helpers/resque_web/failures_helper.rb', line 35 def failure_end_at if failure_start_at + failure_per_page > failure_size failure_size else failure_start_at + failure_per_page end end |
#failure_per_page ⇒ Object
27 28 29 |
# File 'app/helpers/resque_web/failures_helper.rb', line 27 def failure_per_page @failures_per_page ||= params[:class] ? failure_size : 20 end |
#failure_queue ⇒ Object
15 16 17 |
# File 'app/helpers/resque_web/failures_helper.rb', line 15 def failure_queue multiple_failure_queues? ? params[:id] : 'failed' end |
#failure_queue_name ⇒ Object
19 20 21 |
# File 'app/helpers/resque_web/failures_helper.rb', line 19 def failure_queue_name @failure_queue_name ||= params[:queue] ? params[:queue] : 'Failed' end |
#failure_size ⇒ Object
23 24 25 |
# File 'app/helpers/resque_web/failures_helper.rb', line 23 def failure_size @failure_size ||= Resque::Failure.count(params[:id], params[:class]) end |
#failure_start_at ⇒ Object
31 32 33 |
# File 'app/helpers/resque_web/failures_helper.rb', line 31 def failure_start_at params[:start].to_i end |
#job_arguments(job) ⇒ Object
53 54 55 56 |
# File 'app/helpers/resque_web/failures_helper.rb', line 53 def job_arguments(job) return 'nil' unless job['payload'] Array(job['payload']['args']).map { |arg| arg.inspect }.join("\n") end |
#multiple_failure_queues? ⇒ Boolean
11 12 13 |
# File 'app/helpers/resque_web/failures_helper.rb', line 11 def multiple_failure_queues? @multiple_failure_queues ||= Resque::Failure.queues.size > 1 end |