Commit c1c5e475 authored by Vincent Pelletier's avatar Vincent Pelletier

Prepare code simplification: conditionally reconnect to primary master.

This does not change code flow:
- self.master_node is None when entering the loop for the first time
- there is no way to restart the loop other than a PrimaryFailure exception

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1686 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0f46f63d
......@@ -140,8 +140,9 @@ class Application(object):
# start the operation. This cycle will be executed permentnly,
# until the user explicitly requests a shutdown.
while True:
# look for the primary master
self.connectToPrimary()
if self.master_node is None:
# look for the primary master
self.connectToPrimary()
self.operational = False
try:
while True:
......@@ -162,6 +163,7 @@ class Application(object):
except PrimaryFailure, msg:
logging.error('primary master is down: %s', msg)
self.master_node = None
def connectToPrimary(self):
"""Find a primary master node, and connect to it.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment