Created
July 26, 2013 00:51
-
-
Save randomcamel/6085167 to your computer and use it in GitHub Desktop.
If I try to call #inspect on an actor with an active Notifications subscription, it hangs. If you comment out either the `#inspect` call or the subscription, the program runs and exits quickly.
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
# Chris Doherty, code@randomcamel.net | |
require "celluloid" | |
require "celluloid/autostart" | |
class Cell | |
include Celluloid | |
include Celluloid::Notifications | |
attr_reader :count | |
TOPIC_BROADCAST = "topic-broadcast" | |
def initialize | |
@count = 0 | |
# comment out the subscription and the program runs. | |
@sub = subscribe(TOPIC_BROADCAST, :handle_broadcast) | |
end | |
def send_ping | |
@count += 1 | |
publish(TOPIC_BROADCAST, { :name => "cell #{@count}", :clock => @count }) | |
end | |
def handle_broadcast(topic, payload) | |
puts "#{payload[:name]} received message: #{payload.inspect}" | |
end | |
end | |
c1 = Cell.new | |
# comment out the call to #inspect and the program runs. | |
puts c1.inspect | |
puts "inspect succeeded" | |
c2 = Cell.new | |
c1.send_ping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment