diff --git a/lib/statsd.rb b/lib/statsd.rb index 7926d20..730e861 100644 --- a/lib/statsd.rb +++ b/lib/statsd.rb @@ -393,7 +393,7 @@ def time(stat, sample_rate=1) start = Time.now result = yield ensure - timing(stat, ((Time.now - start) * 1000).round, sample_rate) unless $! + timing(stat, ((Time.now - start) * 1000).round, sample_rate) result end diff --git a/spec/statsd_spec.rb b/spec/statsd_spec.rb index 5bf90a0..7ff06b8 100644 --- a/spec/statsd_spec.rb +++ b/spec/statsd_spec.rb @@ -182,17 +182,6 @@ class Statsd end end - describe "when given a block which throws an exception" do - it "should not send" do - @statsd.time('foobar') { raise 'test' } rescue nil - @socket.recv.must_equal nil - end - - it "should not block the exception" do - proc { @statsd.time('foobar') { raise 'test' } }.must_raise RuntimeError - end - end - describe "with a sample rate" do before { class << @statsd; def rand; 0; end; end } # ensure delivery