GC-5050: skip timeouts if no potential machines were found

This commit is contained in:
urihershgc 2016-01-14 14:35:55 +02:00
parent 013c87f478
commit 6fe21a83e1
1 changed files with 5 additions and 2 deletions

View File

@ -169,7 +169,8 @@ class ChaosMonkey(object):
else: else:
self._fail_exploitation_machines.add(machine) 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: if self._keep_running and WormConfiguration.alive:
LOG.info("Reached max iterations (%d)", WormConfiguration.max_iterations) LOG.info("Reached max iterations (%d)", WormConfiguration.max_iterations)
@ -181,7 +182,7 @@ class ChaosMonkey(object):
monkey_tunnel.join() monkey_tunnel.join()
def cleanup(self): def cleanup(self):
LOG.info("Monkey is shutting down") LOG.info("Monkey cleanup started")
self._keep_running = False self._keep_running = False
self._singleton.unlock() self._singleton.unlock()
@ -207,3 +208,5 @@ class ChaosMonkey(object):
os.remove(sys.executable) os.remove(sys.executable)
except Exception, exc: except Exception, exc:
LOG.error("Exception in self delete: %s", exc) LOG.error("Exception in self delete: %s", exc)
LOG.info("Monkey is shutting down")