Skip to content

Instantly share code, notes, and snippets.

@randomcamel
Created July 26, 2013 00:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randomcamel/6085167 to your computer and use it in GitHub Desktop.
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.
# 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