1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

show runtime of each job on the history page

This commit is contained in:
Andrew Allen 2014-09-04 17:04:04 -07:00
parent b1021d8cf1
commit 5a25e45bce
2 changed files with 6 additions and 1 deletions

View file

@ -13,6 +13,7 @@ module Sidetiq
def call_with_sidetiq_history(worker, msg, queue)
entry = new_history_entry
start_time = Time.now
yield
rescue StandardError => e
@ -23,6 +24,7 @@ module Sidetiq
raise e
ensure
entry[:runtime] = (Time.now - start_time)
save_entry_for_worker(entry, worker)
end
@ -33,7 +35,8 @@ module Sidetiq
exception: "",
backtrace: "",
node: "#{Socket.gethostname}:#{Process.pid}-#{Thread.current.object_id}",
timestamp: Time.now.iso8601
timestamp: Time.now.iso8601,
runtime: ""
}
end

View file

@ -17,6 +17,7 @@
<thead>
<th style="width: 10%">Status</th>
<th style="width: 20%">Timestamp</th>
<th style="width: 10%">Runtime</th>
<th>Details</th>
</thead>
@ -25,6 +26,7 @@
<tr class="<%= 'error' if entry[:status] == 'failure' %>">
<td><%= entry[:status].capitalize %></td>
<td><%= Time.parse(entry[:timestamp]).strftime("%m/%d/%Y %I:%M:%S%p") %></td>
<td><%= entry[:runtime].round(3) %> s</td>
<td>
<% if entry[:status] == 'failure' %>
<a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">