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):
del data
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)
return Packets.AskCheckSerialRange(min_oid, min_tid, length, partition)
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)
return Packets.AskCheckTIDRange(min_tid, length, partition)
def _doAskTIDsFrom(self, min_tid, length):
partition_id = self.replicator.getCurrentRID()
max_tid = self.replicator.getCurrentCriticalTID()
replicator = self.app.replicator
partition_id = replicator.getCurrentRID()
max_tid = replicator.getCurrentCriticalTID()
replicator.getTIDsFrom(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):
partition_id = self.replicator.getCurrentRID()
max_serial = self.replicator.getCurrentCriticalTID()
replicator = self.app.replicator
partition_id = replicator.getCurrentRID()
max_serial = replicator.getCurrentCriticalTID()
replicator.getObjectHistoryFrom(min_oid, min_serial, max_serial,
length, partition_id)
return Packets.AskObjectHistoryFrom(min_oid, min_serial, max_serial,
......@@ -200,7 +204,7 @@ class ReplicationHandler(EventHandler):
count + 1))
if p is None:
if count == length and \
max_tid < self.replicator.getCurrentCriticalTID():
max_tid < app.replicator.getCurrentCriticalTID():
# Go on with next chunk
p = self._doAskCheckTIDRange(add64(max_tid, 1))
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