diff --git a/zipline/core/monitor.py b/zipline/core/monitor.py index 5b2b4c72..50c036aa 100644 --- a/zipline/core/monitor.py +++ b/zipline/core/monitor.py @@ -298,7 +298,7 @@ class Controller(object): # We break out of this loop if the time between # sending and receiving the heartbeat is more # than our poll period. - + if tic - self.ctime > self.period: log.info("heartbeat loop timedout: %s" % (tic - self.ctime)) log.info(repr(self.responses)) diff --git a/zipline/test_algorithms.py b/zipline/test_algorithms.py index 68f3d160..a7881fa8 100644 --- a/zipline/test_algorithms.py +++ b/zipline/test_algorithms.py @@ -221,6 +221,32 @@ class DivByZeroAlgorithm(): def get_sid_filter(self): return [self.sid] +class TimeoutAlgorithm(): + + def __init__(self, sid): + self.sid = sid + self.incr = 0 + + def initialize(self): + pass + + def set_order(self, order_callable): + pass + + def set_logger(self, logger): + pass + + def set_portfolio(self, portfolio): + pass + + def handle_data(self, data): + if self.incr > 4: + import time + time.sleep(100) + pass + + def get_sid_filter(self): + return [self.sid] class TestPrintAlgorithm():