aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/notifications.rb')
-rw-r--r--activesupport/lib/active_support/notifications.rb9
1 files changed, 7 insertions, 2 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