Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix lock & changelog times on web interface #762

Merged
merged 5 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/sidekiq_unique_jobs/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def self.create(digest, job_id, lock_info = {})
#
def initialize(key, time: nil)
@key = get_key(key)
@created_at = time.is_a?(Float) ? time : time.to_f
time = time.is_a?(Float) ? time : time.to_f
if time.nonzero?
@created_at = time
end
end

#
Expand Down
2 changes: 2 additions & 0 deletions lib/sidekiq_unique_jobs/web/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def relative_time(time)
# @return [String] a html safe string with relative time information
#
def safe_relative_time(time)
return unless time

time = parse_time(time)

relative_time(time)
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq_unique_jobs/web/views/changelogs.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<tbody>
<% @changelogs.each do |changelog| %>
<tr class="changelog-row">
<td><%= "bogus" %></td>
<td><%= safe_relative_time(changelog['time']) || "bogus" %></td>
<td><%= changelog["digest"] %></td>
<td><%= changelog["script"] %></td>
<td><%= changelog["job_id"] %></td>
Expand Down