Commit 64c0aef0 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix r2364: access replicator where it is: on app.

Also, avoid looking up replicator multiple times.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2367 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 47729240
...@@ -152,24 +152,28 @@ class ReplicationHandler(EventHandler): ...@@ -152,24 +152,28 @@ class ReplicationHandler(EventHandler):
del data del data
def _doAskCheckSerialRange(self, min_oid, min_tid, length=RANGE_LENGTH): def _doAskCheckSerialRange(self, min_oid, min_tid, length=RANGE_LENGTH):
partition = self.replicator.getCurrentRID() replicator = self.app.replicator
partition = replicator.getCurrentRID()
replicator.checkSerialRange(min_oid, min_tid, length, partition) replicator.checkSerialRange(min_oid, min_tid, length, partition)
return Packets.AskCheckSerialRange(min_oid, min_tid, length, partition) return Packets.AskCheckSerialRange(min_oid, min_tid, length, partition)
def _doAskCheckTIDRange(self, min_tid, length=RANGE_LENGTH): def _doAskCheckTIDRange(self, min_tid, length=RANGE_LENGTH):
partition = self.replicator.getCurrentRID() replicator = self.app.replicator
partition = replicator.getCurrentRID()
replicator.checkTIDRange(min_tid, length, partition) replicator.checkTIDRange(min_tid, length, partition)
return Packets.AskCheckTIDRange(min_tid, length, partition) return Packets.AskCheckTIDRange(min_tid, length, partition)
def _doAskTIDsFrom(self, min_tid, length): def _doAskTIDsFrom(self, min_tid, length):
partition_id = self.replicator.getCurrentRID() replicator = self.app.replicator
max_tid = self.replicator.getCurrentCriticalTID() partition_id = replicator.getCurrentRID()
max_tid = replicator.getCurrentCriticalTID()
replicator.getTIDsFrom(min_tid, max_tid, length, partition_id) replicator.getTIDsFrom(min_tid, max_tid, length, partition_id)
return Packets.AskTIDsFrom(min_tid, max_tid, length, partition_id) return Packets.AskTIDsFrom(min_tid, max_tid, length, partition_id)
def _doAskObjectHistoryFrom(self, min_oid, min_serial, length): def _doAskObjectHistoryFrom(self, min_oid, min_serial, length):
partition_id = self.replicator.getCurrentRID() replicator = self.app.replicator
max_serial = self.replicator.getCurrentCriticalTID() partition_id = replicator.getCurrentRID()
max_serial = replicator.getCurrentCriticalTID()
replicator.getObjectHistoryFrom(min_oid, min_serial, max_serial, replicator.getObjectHistoryFrom(min_oid, min_serial, max_serial,
length, partition_id) length, partition_id)
return Packets.AskObjectHistoryFrom(min_oid, min_serial, max_serial, return Packets.AskObjectHistoryFrom(min_oid, min_serial, max_serial,
...@@ -200,7 +204,7 @@ class ReplicationHandler(EventHandler): ...@@ -200,7 +204,7 @@ class ReplicationHandler(EventHandler):
count + 1)) count + 1))
if p is None: if p is None:
if count == length and \ if count == length and \
max_tid < self.replicator.getCurrentCriticalTID(): max_tid < app.replicator.getCurrentCriticalTID():
# Go on with next chunk # Go on with next chunk
p = self._doAskCheckTIDRange(add64(max_tid, 1)) p = self._doAskCheckTIDRange(add64(max_tid, 1))
else: else:
......
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