Sha256: 9537f17f7afc2809d053b2bdbc4c0dc26147546dc4d8ba4bbe52fecdf1acc628

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

Resque::Server.helpers do
  ####################
  #failed.erb helpers#
  ####################

  def failed_date_format
    "%Y/%m/%d %T %z"
  end

  def failed_multiple_queues?
    return @multiple_failed_queues if defined?(@multiple_failed_queues)
    @multiple_failed_queues = Resque::Failure.queues.size > 1
  end

  def failed_size
    @failed_size ||= Resque::Failure.count(params[:queue], params[:class])
  end

  def failed_per_page
    @failed_per_page = if params[:class]
      failed_size  
    else
      20
    end
  end

  def failed_start_at
    params[:start].to_i
  end

  def failed_end_at
    if failed_start_at + failed_per_page > failed_size
      failed_size
    else
      failed_start_at  + failed_per_page
    end
  end

  def failed_order
    params[:order] || 'desc'
  end

  def failed_class_counts(queue = params[:queue])
    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
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
resque-1.25.2 lib/resque/server/helpers.rb
resque-1.26.pre.0 lib/resque/server/helpers.rb
resque_signal_from_child-1.25.1 lib/resque/server/helpers.rb
resque-1.25.1 lib/resque/server/helpers.rb
resque-1.25.0 lib/resque/server/helpers.rb
resque-1.25.0.pre lib/resque/server/helpers.rb