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,11 +159,6 @@ class Application(object): ...@@ -159,11 +159,6 @@ class Application(object):
node.setState(RUNNING_STATE) node.setState(RUNNING_STATE)
self.negotiating_master_node_set.clear() self.negotiating_master_node_set.clear()
try:
while 1:
current_time = time()
if current_time >= t + 1:
t = current_time
# Expire temporarily down nodes. For now, assume that a node # Expire temporarily down nodes. For now, assume that a node
# which is down for 60 seconds is really down, if this is a # which is down for 60 seconds is really down, if this is a
# bootstrap. 60 seconds may sound too long, but this is reasonable # bootstrap. 60 seconds may sound too long, but this is reasonable
...@@ -174,6 +169,12 @@ class Application(object): ...@@ -174,6 +169,12 @@ class Application(object):
expiration = 60 expiration = 60
else: else:
expiration = 10 expiration = 10
try:
while 1:
current_time = time()
if current_time >= t + 1:
t = current_time
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