lib/celluloid/supervisor.rb in celluloid-0.8.0 vs lib/celluloid/supervisor.rb in celluloid-0.9.0

- old
+ new

@@ -26,11 +26,11 @@ def start_actor(start_attempts = 3, sleep_interval = 30) failures = 0 begin @actor = @klass.new_link(*@args, &@block) - rescue => ex + rescue failures += 1 if failures >= start_attempts failures = 0 Logger.warn("#{@klass} is crashing on initialize too quickly, sleeping for #{sleep_interval} seconds") @@ -43,9 +43,12 @@ Actor[@name] = @actor if @name end # When actors die, regardless of the reason, restart them def restart_actor(actor, reason) + # If the actor we're supervising exited cleanly, exit the supervisor cleanly too + terminate unless reason + start_actor if @started end def inspect str = "#<#{self.class}(#{@klass}):0x#{object_id.to_s(16)}"