From 31248fe3698c8d6c54465dfdf463ea49749e1c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 4 Feb 2010 10:39:55 +0100 Subject: Remove instrument! and require thread from AS::Notifications. --- activesupport/lib/active_support/notifications.rb | 2 +- activesupport/lib/active_support/notifications/fanout.rb | 4 +--- activesupport/lib/active_support/notifications/instrumenter.rb | 9 --------- 3 files changed, 2 insertions(+), 13 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index a1383bb478..3e96decb8c 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -45,7 +45,7 @@ module ActiveSupport class << self attr_writer :notifier delegate :publish, :subscribe, :to => :notifier - delegate :instrument, :instrument!, :to => :instrumenter + delegate :instrument, :to => :instrumenter def notifier @notifier ||= Notifier.new diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb index ac482a2ec8..0ec23da073 100644 --- a/activesupport/lib/active_support/notifications/fanout.rb +++ b/activesupport/lib/active_support/notifications/fanout.rb @@ -1,5 +1,3 @@ -require 'thread' - module ActiveSupport module Notifications # This is a default queue implementation that ships with Notifications. It @@ -21,8 +19,8 @@ module ActiveSupport @subscribers.each { |s| s.publish(*args) } end + # This is a sync queue, so there is not waiting. def wait - sleep(0.05) until @subscribers.all?(&:drained?) end # Used for internal implementation only. diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 7c5b118ee3..f3d877efe7 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -20,15 +20,6 @@ module ActiveSupport result end - # The same as instrument, but sends the notification even if the yielded - # block raises an error. - def instrument!(name, payload={}) - time = Time.now - yield(payload) if block_given? - ensure - @notifier.publish(name, time, Time.now, @id, payload) - end - private def unique_id SecureRandom.hex(10) -- cgit v1.2.3