lib/jflow/cli.rb in jflow-0.5.0 vs lib/jflow/cli.rb in jflow-0.5.1

- old
+ new

@@ -68,12 +68,17 @@ Thread.current.set_state(:polling) stats = JFlow::Stats.new(@domain, @tasklist) protector = JFlow::TerminationProtector.new loop do break if Thread.current.marked_for_shutdown? - protector.set_protection(should_protect?) if is_ec2_instance? - stats.tick if enable_stats - sleep 30 + begin + protector.set_protection(should_protect?) if is_ec2_instance? + stats.tick if enable_stats + sleep 30 + rescue => e + JFlow.handle_exception(e) + sleep 180 + end end end end # returns true if any thread if working on someting