diff options
| -rw-r--r-- | activesupport/lib/active_support/notifications.rb | 9 | ||||
| -rw-r--r-- | activesupport/test/notifications_test.rb | 2 | 
2 files changed, 8 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb index 7a9f76b26a..09b1aa1713 100644 --- a/activesupport/lib/active_support/notifications.rb +++ b/activesupport/lib/active_support/notifications.rb @@ -154,10 +154,15 @@ module ActiveSupport          @listeners << Listener.new(pattern, &block)        end -      def drained? -        @listeners.all? &:drained? +      def wait +        sleep 0.05 until drained?        end +      private +        def drained? +          @listeners.all? &:drained? +        end +        class Listener          def initialize(pattern, &block)            @pattern = pattern diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 01106e83e9..3df2088ac9 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -201,6 +201,6 @@ class NotificationsMainTest < Test::Unit::TestCase    private      def drain -      sleep(0.1) until ActiveSupport::Notifications.queue.drained? +      ActiveSupport::Notifications.queue.wait      end  end  | 
