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

Busy page should show proper TID and JID

This commit is contained in:
Mike Perham 2014-03-19 20:12:12 -07:00
parent ddb58482cf
commit 3bee1ad7b9
2 changed files with 6 additions and 4 deletions

View file

@ -70,7 +70,7 @@ module Sidekiq
private
def thread_identity
@str ||= "#{identity}-#{Thread.current.object_id}"
@str ||= Thread.current.object_id.to_s(36)
end
def stats(worker, msg, queue)
@ -80,7 +80,7 @@ module Sidekiq
hash = Sidekiq.dump_json({:queue => queue, :payload => msg, :run_at => Time.now.to_i })
Sidekiq.redis do |conn|
conn.multi do
conn.hmset("#{identity}:workers", Thread.current.object_id, hash)
conn.hmset("#{identity}:workers", thread_identity, hash)
conn.expire("#{identity}:workers", 60*60)
end
end
@ -105,7 +105,7 @@ module Sidekiq
Sidekiq.redis do |conn|
processed = "stat:processed:#{Time.now.utc.to_date}"
result = conn.multi do
conn.hdel("#{identity}:workers", Thread.current.object_id)
conn.hdel("#{identity}:workers", thread_identity)
conn.incrby("stat:processed", 1)
conn.incrby(processed, 1)
end

View file

@ -30,7 +30,8 @@
<table class="workers table table-hover table-bordered table-striped table-white">
<thead>
<th><%= t('Process') %></th>
<th><%= t('Thread') %></th>
<th><%= t('TID') %></th>
<th><%= t('JID') %></th>
<th><%= t('Queue') %></th>
<th><%= t('Class') %></th>
<th><%= t('Arguments') %></th>
@ -40,6 +41,7 @@
<tr>
<td><%= process %></td>
<td><%= thread %></td>
<td><%= msg['payload']['jid'] %></td>
<td>
<a href="<%= root_path %>queues/<%= msg['queue'] %>"><%= msg['queue'] %></a>
</td>