Commit d637c812 authored by Vincent Pelletier's avatar Vincent Pelletier

Move loop invariants out of loop.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1182 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f4e9985d
...@@ -159,21 +159,22 @@ class Application(object): ...@@ -159,21 +159,22 @@ class Application(object):
node.setState(RUNNING_STATE) node.setState(RUNNING_STATE)
self.negotiating_master_node_set.clear() self.negotiating_master_node_set.clear()
# Expire temporarily down nodes. For now, assume that a node
# which is down for 60 seconds is really down, if this is a
# bootstrap. 60 seconds may sound too long, but this is reasonable
# when rebooting many cluster machines. Otherwise, wait for only
# 10 seconds, because stopping the whole cluster for a long time
# is a bad idea.
if bootstrap:
expiration = 60
else:
expiration = 10
try: try:
while 1: while 1:
current_time = time() current_time = time()
if current_time >= t + 1: if current_time >= t + 1:
t = current_time t = current_time
# Expire temporarily down nodes. For now, assume that a node
# which is down for 60 seconds is really down, if this is a
# bootstrap. 60 seconds may sound too long, but this is reasonable
# when rebooting many cluster machines. Otherwise, wait for only
# 10 seconds, because stopping the whole cluster for a long time
# is a bad idea.
if bootstrap:
expiration = 60
else:
expiration = 10
for node in nm.getMasterNodeList(): for node in nm.getMasterNodeList():
if node.getState() == TEMPORARILY_DOWN_STATE \ if node.getState() == TEMPORARILY_DOWN_STATE \
and node.getLastStateChange() + expiration < current_time: and node.getLastStateChange() + expiration < current_time:
......
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