mirror of
https://github.com/endofunky/sidetiq.git
synced 2022-11-09 13:53:30 -05:00
Merge branch 'allenan-runtime-history'
This commit is contained in:
commit
2bfa02141d
3 changed files with 8 additions and 1 deletions
|
@ -13,6 +13,7 @@ module Sidetiq
|
||||||
|
|
||||||
def call_with_sidetiq_history(worker, msg, queue)
|
def call_with_sidetiq_history(worker, msg, queue)
|
||||||
entry = new_history_entry
|
entry = new_history_entry
|
||||||
|
start_time = Time.now
|
||||||
|
|
||||||
yield
|
yield
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
|
@ -23,6 +24,7 @@ module Sidetiq
|
||||||
|
|
||||||
raise e
|
raise e
|
||||||
ensure
|
ensure
|
||||||
|
entry[:runtime] = (Time.now - start_time)
|
||||||
save_entry_for_worker(entry, worker)
|
save_entry_for_worker(entry, worker)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,7 +35,8 @@ module Sidetiq
|
||||||
exception: "",
|
exception: "",
|
||||||
backtrace: "",
|
backtrace: "",
|
||||||
node: "#{Socket.gethostname}:#{Process.pid}-#{Thread.current.object_id}",
|
node: "#{Socket.gethostname}:#{Process.pid}-#{Thread.current.object_id}",
|
||||||
timestamp: Time.now.iso8601
|
timestamp: Time.now.iso8601,
|
||||||
|
runtime: ""
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<thead>
|
<thead>
|
||||||
<th style="width: 10%">Status</th>
|
<th style="width: 10%">Status</th>
|
||||||
<th style="width: 20%">Timestamp</th>
|
<th style="width: 20%">Timestamp</th>
|
||||||
|
<th style="width: 10%">Runtime</th>
|
||||||
<th>Details</th>
|
<th>Details</th>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@
|
||||||
<tr class="<%= 'error' if entry[:status] == 'failure' %>">
|
<tr class="<%= 'error' if entry[:status] == 'failure' %>">
|
||||||
<td><%= entry[:status].capitalize %></td>
|
<td><%= entry[:status].capitalize %></td>
|
||||||
<td><%= Time.parse(entry[:timestamp]).strftime("%m/%d/%Y %I:%M:%S%p") %></td>
|
<td><%= Time.parse(entry[:timestamp]).strftime("%m/%d/%Y %I:%M:%S%p") %></td>
|
||||||
|
<td><%= entry[:runtime].round(3) %> s</td>
|
||||||
<td>
|
<td>
|
||||||
<% if entry[:status] == 'failure' %>
|
<% if entry[:status] == 'failure' %>
|
||||||
<a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">
|
<a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">
|
||||||
|
|
|
@ -23,6 +23,7 @@ class TestHistory < Sidetiq::TestCase
|
||||||
|
|
||||||
refute_empty actual[:node]
|
refute_empty actual[:node]
|
||||||
refute_empty actual[:timestamp]
|
refute_empty actual[:timestamp]
|
||||||
|
assert actual[:runtime] > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_failure
|
def test_failure
|
||||||
|
@ -47,6 +48,7 @@ class TestHistory < Sidetiq::TestCase
|
||||||
|
|
||||||
refute_empty actual[:node]
|
refute_empty actual[:node]
|
||||||
refute_empty actual[:timestamp]
|
refute_empty actual[:timestamp]
|
||||||
|
assert actual[:runtime] > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def middlewared
|
def middlewared
|
||||||
|
|
Loading…
Reference in a new issue