diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-06-05 15:50:52 +0100 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-06-11 16:33:47 +0100 |
commit | 58e738ceb4b35031793a35e8affc929c7d82f76b (patch) | |
tree | a883ff57d8ab08656133e7a77c4760e6c15162cc /morphlib/buildcommand.py | |
parent | 3e7af0afebff07df01db4785c1b82614e0aeaa9a (diff) | |
download | morph-58e738ceb4b35031793a35e8affc929c7d82f76b.tar.gz |
Make buildcommand use InitiatorConnectionMachine
After a failed attempt to connect to the controller node
the initiator will wait 30 seconds before attempting a reconnect,
if this reconnect fails the initiator gives up.
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r-- | morphlib/buildcommand.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 9fab5c07..f68046e3 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -502,6 +502,9 @@ class BuildCommand(object): class InitiatorBuildCommand(BuildCommand): + RECONNECT_INTERVAL = 30 # seconds + MAX_RETRIES = 1 + def __init__(self, app, addr, port): self.app = app self.addr = addr @@ -524,7 +527,13 @@ class InitiatorBuildCommand(BuildCommand): self.app.status(msg='Starting distributed build') loop = distbuild.MainLoop() - cm = distbuild.ConnectionMachine( - self.addr, self.port, distbuild.Initiator, [self.app] + args) + cm = distbuild.InitiatorConnectionMachine(self.app, + self.addr, + self.port, + distbuild.Initiator, + [self.app] + args, + self.RECONNECT_INTERVAL, + self.MAX_RETRIES) + loop.add_state_machine(cm) loop.run() |