Commit 40fc5505 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Replace 'while 1' statements with 'while True'.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1495 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 82f27499
...@@ -91,10 +91,10 @@ class Application(object): ...@@ -91,10 +91,10 @@ class Application(object):
# Connect to a primary master node, verify data, and # Connect to a primary master node, verify data, and
# start the operation. This cycle will be executed permentnly, # start the operation. This cycle will be executed permentnly,
# until the user explicitly requests a shutdown. # until the user explicitly requests a shutdown.
while 1: while True:
self.connectToPrimary() self.connectToPrimary()
try: try:
while 1: while True:
self.em.poll(1) self.em.poll(1)
except PrimaryFailure: except PrimaryFailure:
logging.error('primary master is down') logging.error('primary master is down')
......
...@@ -297,7 +297,7 @@ class Application(object): ...@@ -297,7 +297,7 @@ class Application(object):
def _waitMessage(self, target_conn = None, msg_id = None, handler=None): def _waitMessage(self, target_conn = None, msg_id = None, handler=None):
"""Wait for a message returned by the dispatcher in queues.""" """Wait for a message returned by the dispatcher in queues."""
local_queue = self.local_var.queue local_queue = self.local_var.queue
while 1: while True:
if msg_id is None: if msg_id is None:
try: try:
conn, packet = local_queue.get_nowait() conn, packet = local_queue.get_nowait()
......
...@@ -235,7 +235,7 @@ class Connection(BaseConnection): ...@@ -235,7 +235,7 @@ class Connection(BaseConnection):
def analyse(self): def analyse(self):
"""Analyse received data.""" """Analyse received data."""
while 1: while True:
packet = None packet = None
try: try:
packet = Packets.parse(self.read_buf) packet = Packets.parse(self.read_buf)
......
...@@ -80,7 +80,7 @@ class Epoll(object): ...@@ -80,7 +80,7 @@ class Epoll(object):
else: else:
timeout *= 1000 timeout *= 1000
timeout = int(timeout) timeout = int(timeout)
while 1: while True:
n = epoll_wait(self.efd, byref(self.events), self.maxevents, n = epoll_wait(self.efd, byref(self.events), self.maxevents,
timeout) timeout)
if n == -1: if n == -1:
......
...@@ -109,7 +109,7 @@ class Application(object): ...@@ -109,7 +109,7 @@ class Application(object):
self.electPrimary() self.electPrimary()
# Start a normal operation. # Start a normal operation.
while 1: while True:
try: try:
if self.primary: if self.primary:
self.playPrimaryRole() self.playPrimaryRole()
...@@ -466,7 +466,7 @@ class Application(object): ...@@ -466,7 +466,7 @@ class Application(object):
if len(self.asking_uuid_dict) == 0: if len(self.asking_uuid_dict) == 0:
raise VerificationFailure raise VerificationFailure
while 1: while True:
em.poll(1) em.poll(1)
if not self.pt.operational(): if not self.pt.operational():
raise VerificationFailure raise VerificationFailure
...@@ -494,7 +494,7 @@ class Application(object): ...@@ -494,7 +494,7 @@ class Application(object):
self.asking_uuid_dict[uuid] = False self.asking_uuid_dict[uuid] = False
conn.ask(Packets.AskObjectPresent(oid, tid)) conn.ask(Packets.AskObjectPresent(oid, tid))
while 1: while True:
em.poll(1) em.poll(1)
if not self.pt.operational(): if not self.pt.operational():
raise VerificationFailure raise VerificationFailure
...@@ -531,7 +531,7 @@ class Application(object): ...@@ -531,7 +531,7 @@ class Application(object):
self.asking_uuid_dict[uuid] = False self.asking_uuid_dict[uuid] = False
conn.ask(Packets.AskUnfinishedTransactions()) conn.ask(Packets.AskUnfinishedTransactions())
while 1: while True:
em.poll(1) em.poll(1)
if not self.pt.operational(): if not self.pt.operational():
raise VerificationFailure raise VerificationFailure
...@@ -633,7 +633,7 @@ class Application(object): ...@@ -633,7 +633,7 @@ class Application(object):
# recover the cluster status at startup # recover the cluster status at startup
self.recoverStatus() self.recoverStatus()
while 1: while True:
try: try:
self.verifyData() self.verifyData()
except VerificationFailure: except VerificationFailure:
...@@ -657,7 +657,7 @@ class Application(object): ...@@ -657,7 +657,7 @@ class Application(object):
handler = identification.IdentificationHandler(self) handler = identification.IdentificationHandler(self)
self.listening_conn.setHandler(handler) self.listening_conn.setHandler(handler)
while 1: while True:
self.em.poll(1) self.em.poll(1)
def changeClusterState(self, state): def changeClusterState(self, state):
...@@ -740,7 +740,7 @@ class Application(object): ...@@ -740,7 +740,7 @@ class Application(object):
c.setHandler(handler) c.setHandler(handler)
# wait for all transaction to be finished # wait for all transaction to be finished
while 1: while True:
self.em.poll(1) self.em.poll(1)
if not self.tm.hasPending(): if not self.tm.hasPending():
if self.cluster_state == ClusterStates.RUNNING: if self.cluster_state == ClusterStates.RUNNING:
......
...@@ -140,12 +140,12 @@ class Application(object): ...@@ -140,12 +140,12 @@ class Application(object):
# Connect to a primary master node, verify data, and # Connect to a primary master node, verify data, and
# start the operation. This cycle will be executed permentnly, # start the operation. This cycle will be executed permentnly,
# until the user explicitly requests a shutdown. # until the user explicitly requests a shutdown.
while 1: while True:
# look for the primary master # look for the primary master
self.connectToPrimary() self.connectToPrimary()
self.operational = False self.operational = False
try: try:
while 1: while True:
try: try:
# check my state # check my state
node = self.nm.getByUUID(self.uuid) node = self.nm.getByUUID(self.uuid)
...@@ -262,7 +262,7 @@ class Application(object): ...@@ -262,7 +262,7 @@ class Application(object):
# The replicator. # The replicator.
self.replicator = Replicator(self) self.replicator = Replicator(self)
while 1: while True:
em.poll(1) em.poll(1)
if self.replicator.pending(): if self.replicator.pending():
self.replicator.act() self.replicator.act()
...@@ -275,7 +275,7 @@ class Application(object): ...@@ -275,7 +275,7 @@ class Application(object):
conn.setHandler(handler) conn.setHandler(handler)
node = self.nm.getByUUID(self.uuid) node = self.nm.getByUUID(self.uuid)
while 1: while True:
self.em.poll(1) self.em.poll(1)
if not node.isHidden(): if not node.isHidden():
break break
......
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