1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Update busy UI with latest changes

This commit is contained in:
Mike Perham 2014-03-08 14:21:52 -08:00
parent 8f49ee96ac
commit 8d55757f6e
2 changed files with 12 additions and 5 deletions

View file

@ -472,12 +472,14 @@ module Sidekiq
#
# workers = Sidekiq::Workers.new
# workers.size => 2
# workers.each do |name, work|
# # name is a unique identifier per worker
# workers.each do |process_id, thread_id, work|
# # process_id is a unique identifier per Sidekiq process
# # thread_id is a unique identifier per thread
# # work is a Hash which looks like:
# # { 'queue' => name, 'run_at' => timestamp, 'payload' => msg }
# # run_at is an epoch Integer.
# end
#
class Workers
include Enumerable
@ -491,12 +493,15 @@ module Sidekiq
end
next unless valid
workers.each_pair do |tid, json|
yield tid, Sidekiq.load_json(json)
yield key, tid, Sidekiq.load_json(json)
end
end
end
end
# Note that #size is only as accurate as Sidekiq's heartbeat,
# which happens every 5 seconds. It is NOT real-time.
#
# Not very efficient if you have lots of Sidekiq
# processes but the alternative is a global counter
# which can easily get out of sync with crashy processes.

View file

@ -13,7 +13,7 @@
</thead>
<% Sidekiq::ProcessSet.new.each_with_index do |process, index| %>
<tr>
<td><%= process['key'] %></td>
<td><%= process['hostname'] %>:<%= process['pid'] %></td>
<td><%= relative_time(Time.at(process['started_at'])) %></td>
<td><%= process['concurrency'] %></td>
<td><%= process['busy'] %></td>
@ -29,14 +29,16 @@
<table class="workers table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Process') %></th>
<th><%= t('Thread') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Class') %></th>
<th><%= t('Arguments') %></th>
<th><%= t('Started') %></th>
</thead>
<% workers.each_with_index do |(thread, msg), index| %>
<% workers.each_with_index do |(process, thread, msg), index| %>
<tr>
<td><%= process %></td>
<td><%= thread %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>