Commit e1b3be04 authored by Julien Muchembled's avatar Julien Muchembled

Simplify code of PartitionTable.addNode

parent 85600dbd
...@@ -163,10 +163,8 @@ class PartitionTable(PartitionTable): ...@@ -163,10 +163,8 @@ class PartitionTable(PartitionTable):
max_count = 0 max_count = 0
max_cell = None max_cell = None
num_cells = 0 num_cells = 0
skip = False
for cell in row: for cell in row:
if cell.getNode() == node: if cell.getNode() is node:
skip = True
break break
if cell.isFeeding(): if cell.isFeeding():
feeding_cell = cell feeding_cell = cell
...@@ -177,16 +175,13 @@ class PartitionTable(PartitionTable): ...@@ -177,16 +175,13 @@ class PartitionTable(PartitionTable):
max_count = count max_count = count
max_cell = cell max_cell = cell
if skip:
continue
if num_cells <= self.nr:
row.append(neo.lib.pt.Cell(node, CellStates.OUT_OF_DATE))
cell_list.append((offset, node.getUUID(),
CellStates.OUT_OF_DATE))
node_count += 1
else: else:
if max_count - node_count > 1: if num_cells <= self.nr:
row.append(neo.lib.pt.Cell(node, CellStates.OUT_OF_DATE))
cell_list.append((offset, node.getUUID(),
CellStates.OUT_OF_DATE))
node_count += 1
elif node_count + 1 < max_count:
if feeding_cell is not None or max_cell.isOutOfDate(): if feeding_cell is not None or max_cell.isOutOfDate():
# If there is a feeding cell already or it is # If there is a feeding cell already or it is
# out-of-date, just drop the node. # out-of-date, just drop the node.
......
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