From 6fe21a83e18744337e9f2b9cdc0afa1c3e552947 Mon Sep 17 00:00:00 2001 From: urihershgc Date: Thu, 14 Jan 2016 14:35:55 +0200 Subject: [PATCH] GC-5050: skip timeouts if no potential machines were found --- chaos_monkey/monkey.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chaos_monkey/monkey.py b/chaos_monkey/monkey.py index af8e69143..74af64daf 100644 --- a/chaos_monkey/monkey.py +++ b/chaos_monkey/monkey.py @@ -169,7 +169,8 @@ class ChaosMonkey(object): else: self._fail_exploitation_machines.add(machine) - time.sleep(WormConfiguration.timeout_between_iterations) + if machines: + time.sleep(WormConfiguration.timeout_between_iterations) if self._keep_running and WormConfiguration.alive: LOG.info("Reached max iterations (%d)", WormConfiguration.max_iterations) @@ -181,7 +182,7 @@ class ChaosMonkey(object): monkey_tunnel.join() def cleanup(self): - LOG.info("Monkey is shutting down") + LOG.info("Monkey cleanup started") self._keep_running = False self._singleton.unlock() @@ -207,3 +208,5 @@ class ChaosMonkey(object): os.remove(sys.executable) except Exception, exc: LOG.error("Exception in self delete: %s", exc) + + LOG.info("Monkey is shutting down")