From f243b96fd2639d46b392bcda5ed5430237763d95 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Sun, 10 Nov 2013 10:40:21 -0800 Subject: [PATCH] Rework retries and scheduled index page to use API --- lib/sidekiq/web.rb | 4 ++-- web/views/retries.erb | 16 ++++++++-------- web/views/scheduled.erb | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/sidekiq/web.rb b/lib/sidekiq/web.rb index e69d34e7..2288b4e3 100644 --- a/lib/sidekiq/web.rb +++ b/lib/sidekiq/web.rb @@ -73,7 +73,7 @@ module Sidekiq get '/retries' do @count = (params[:count] || 25).to_i (@current_page, @total_size, @retries) = page("retry", params[:page], @count) - @retries = @retries.map {|msg, score| [Sidekiq.load_json(msg), score] } + @retries = @retries.map {|msg, score| Sidekiq::SortedEntry.new(nil, score, msg) } erb :retries end @@ -125,7 +125,7 @@ module Sidekiq get '/scheduled' do @count = (params[:count] || 25).to_i (@current_page, @total_size, @scheduled) = page("schedule", params[:page], @count) - @scheduled = @scheduled.map {|msg, score| [Sidekiq.load_json(msg), score] } + @scheduled = @scheduled.map {|msg, score| Sidekiq::SortedEntry.new(nil, score, msg) } erb :scheduled end diff --git a/web/views/retries.erb b/web/views/retries.erb index e5f75e26..4370b2e3 100644 --- a/web/views/retries.erb +++ b/web/views/retries.erb @@ -25,24 +25,24 @@ <%= t('Error') %> - <% @retries.each do |msg, score| %> + <% @retries.each do |entry| %> - + - <%= relative_time(Time.at(score)) %> + <%= relative_time(entry.at) %> - <%= msg['retry_count'] %> + <%= entry['retry_count'] %> - <%= msg['queue'] %> + <%= entry.queue %> - <%= msg['class'] %> + <%= entry.klass %> -
<%= display_args(msg['args']) %>
+
<%= display_args(entry.args) %>
-
<%= h truncate("#{msg['error_class']}: #{msg['error_message']}", 200) %>
+
<%= h truncate("#{entry['error_class']}: #{entry['error_message']}", 200) %>
<% end %> diff --git a/web/views/scheduled.erb b/web/views/scheduled.erb index 2afb8222..2dd0680a 100644 --- a/web/views/scheduled.erb +++ b/web/views/scheduled.erb @@ -24,20 +24,20 @@ <%= t('Arguments') %> - <% @scheduled.each do |msg, score| %> + <% @scheduled.each do |entry| %> - + - <%= relative_time(Time.at(score)) %> + <%= relative_time(entry.at) %> - <%= msg['queue'] %> + <%= entry.queue %> - <%= msg['class'] %> + <%= entry.klass %> -
<%= display_args(msg['args']) %>
+
<%= display_args(entry.args) %>
<% end %>