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)
|
||||
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
|
||||
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -23,6 +23,7 @@ class TestHistory < Sidetiq::TestCase
|
|||
|
||||
refute_empty actual[:node]
|
||||
refute_empty actual[:timestamp]
|
||||
assert actual[:runtime] > 0
|
||||
end
|
||||
|
||||
def test_failure
|
||||
|
@ -47,6 +48,7 @@ class TestHistory < Sidetiq::TestCase
|
|||
|
||||
refute_empty actual[:node]
|
||||
refute_empty actual[:timestamp]
|
||||
assert actual[:runtime] > 0
|
||||
end
|
||||
|
||||
def middlewared
|
||||
|
|
Loading…
Reference in a new issue