Created
February 13, 2019 02:27
-
-
Save johnkchow/c53770563ee551e7199e28e60284b10f to your computer and use it in GitHub Desktop.
ActiveSupport::Notifications will discontinue calling subscriber chain if any subscriber fails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> load '/private/var/folders/9q/0tnb0bwj5514jj4xl440f4j80000gn/T/sample.rb' | |
publish done | |
1 | |
2 | |
into 3 | |
Traceback (most recent call last): | |
12: from /Users/johnkchow/.rbenv/versions/2.5.1/bin/irb:11:in `<main>' | |
11: from (irb):1 | |
10: from (irb):1:in `load' | |
9: from /private/var/folders/9q/0tnb0bwj5514jj4xl440f4j80000gn/T/foo.rb:22:in `<top (required)>' | |
8: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications.rb:164:in `instrument' | |
7: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications/instrumenter.rb:25:in `instrument' | |
6: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications/instrumenter.rb:36:in `finish' | |
5: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications/fanout.rb:46:in `finish' | |
4: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications/fanout.rb:46:in `each' | |
3: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications/fanout.rb:46:in `block in finish' | |
2: from /Users/johnkchow/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/activesupport-4.2.11/lib/active_support/notifications/fanout.rb:127:in `finish' | |
1: from /private/var/folders/9q/0tnb0bwj5514jj4xl440f4j80000gn/T/sample.rb:14:in `block in <top (required)>' | |
RuntimeError (foo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support' | |
begin | |
ActiveSupport::Notifications.subscribe('foo') do | |
puts "1" | |
end | |
ActiveSupport::Notifications.subscribe('foo') do | |
puts "2" | |
end | |
ActiveSupport::Notifications.subscribe('foo') do | |
puts "into 3" | |
raise "foo" | |
end | |
ActiveSupport::Notifications.subscribe('foo') do | |
# this never gets outputted | |
puts "4" | |
end | |
ActiveSupport::Notifications.instrument('foo', extra: :information) do | |
# this never gets outputted | |
puts "publish done" | |
end | |
ensure | |
ActiveSupport::Notifications.unsubscribe('foo') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment