mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add retry job page to web
This commit is contained in:
parent
ee42be39e0
commit
c514bde486
3 changed files with 59 additions and 1 deletions
|
@ -85,6 +85,13 @@ module Sidekiq
|
|||
end
|
||||
end
|
||||
|
||||
def retries_with_score(score)
|
||||
Sidekiq.redis do |conn|
|
||||
results = conn.zrangebyscore('retry', @score, @score, :withscores => true)
|
||||
results.each_slice(2).map { |msg, score| [MultiJson.decode(msg), Float(score)] }
|
||||
end
|
||||
end
|
||||
|
||||
def location
|
||||
Sidekiq.redis { |conn| conn.client.location }
|
||||
end
|
||||
|
@ -115,6 +122,12 @@ module Sidekiq
|
|||
@messages = Sidekiq.redis {|conn| conn.lrange("queue:#{@name}", 0, 10) }.map { |str| MultiJson.decode(str) }
|
||||
slim :queue
|
||||
end
|
||||
|
||||
get "/retries/:score" do
|
||||
halt 404 unless params[:score]
|
||||
@score = params[:score]
|
||||
slim :retry
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
th Args
|
||||
- retries.each do |(msg, score)|
|
||||
tr
|
||||
td= Time.at(score)
|
||||
td
|
||||
a href="retries/#{score}" #{Time.at(score)}
|
||||
td= msg['retry_count']
|
||||
td
|
||||
a href="queues/#{msg['queue']}" #{msg['queue']}
|
||||
|
|
44
web/views/retry.slim
Normal file
44
web/views/retry.slim
Normal file
|
@ -0,0 +1,44 @@
|
|||
header
|
||||
h1 Retry Job #{@score}
|
||||
|
||||
- retries_with_score(@score).each do |(msg, score)|
|
||||
table class="table table-striped table-bordered"
|
||||
thead
|
||||
tr
|
||||
th Key
|
||||
th Value
|
||||
tbody
|
||||
tr
|
||||
td Queue
|
||||
td
|
||||
a href="queues/#{msg['queue']}" #{msg['queue']}
|
||||
tr
|
||||
td Job Class
|
||||
td
|
||||
code= msg['class']
|
||||
tr
|
||||
td Job Arguments
|
||||
td
|
||||
code= msg['args'].inspect[0..100]
|
||||
tr
|
||||
td Error Class
|
||||
td
|
||||
code= msg['error_class']
|
||||
tr
|
||||
td Error Message
|
||||
td= msg['error_message']
|
||||
- if msg['retry_count'] > 0
|
||||
tr
|
||||
td Retry Count
|
||||
td= msg['retry_count']
|
||||
tr
|
||||
td Last Retry
|
||||
td= Time.parse(msg['retried_at'])
|
||||
- else
|
||||
tr
|
||||
td Originally Failed
|
||||
td= Time.parse(msg['failed_at'])
|
||||
tr
|
||||
td Next Retry
|
||||
td= Time.at(score)
|
||||
|
Loading…
Add table
Reference in a new issue