From 03b17bbfb51047901e64d18ac3726b45e1037af9 Mon Sep 17 00:00:00 2001 From: fawce Date: Thu, 19 Jul 2012 20:17:44 -0400 Subject: [PATCH] added a condition to break out of the heartbeat on the initial loop, once all components report themselves once. --- zipline/core/monitor.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zipline/core/monitor.py b/zipline/core/monitor.py index 11b91fa8..1767958d 100644 --- a/zipline/core/monitor.py +++ b/zipline/core/monitor.py @@ -289,6 +289,8 @@ class Controller(object): # Hearbeat Cycle # ============== + initializing = len(self.tracked) == 0 and len(self.finished) == 0 + # Wait the responses while self.alive: @@ -318,6 +320,13 @@ class Controller(object): log.info(repr(self.responses)) break + # if this is the first time heartbeating, break + # out early if we get everything tracked no need + # to hold out for the full heartbeat. + if initializing and len(self.responses) == len(self.topology): + log.info("breaking out of initial heartbeat") + break + # ================ # Heartbeat Stats # ================