lib/new_relic/agent/datastores.rb in newrelic_rpm-5.1.0.344 vs lib/new_relic/agent/datastores.rb in newrelic_rpm-5.2.0.345
- old
+ new
@@ -119,14 +119,17 @@
)
begin
result = yield
ensure
- if callback
- elapsed_time = (Time.now - segment.start_time).to_f
- callback.call(result, segment.name, elapsed_time)
+ begin
+ if callback
+ elapsed_time = (Time.now - segment.start_time).to_f
+ callback.call(result, segment.name, elapsed_time)
+ end
+ ensure
+ segment.finish if segment
end
- segment.finish if segment
end
end
# @!group Capturing query / statement text