Skip to content

Commit

Permalink
Move duration into ensure block since it wasn't getting set on failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jclusso committed Feb 17, 2024
1 parent 4726232 commit 6c9a00c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/lib/dns_lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def run(domain, type)
domain = "#{domain.split('.').reverse.join('.')}.in-addr.arpa"
end
response = resolver.query(domain, type)
@duration = (Time.monotonic_now - start_time) * 1000

{
json: {
Expand All @@ -33,6 +32,8 @@ def run(domain, type)
{ json: { status: 'NOTIMP', from: @server }, zone: e.response.to_s }
rescue Dnsruby::OtherResolvError
{ json: { status: 'OTHER ERROR', from: @server } }
ensure
@duration = (Time.monotonic_now - start_time) * 1000
end

private
Expand Down

0 comments on commit 6c9a00c

Please sign in to comment.