[Neo-report] r2367 vincent - /trunk/neo/storage/handlers/replication.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Oct 29 19:41:24 CEST 2010


Author: vincent
Date: Fri Oct 29 19:41:23 2010
New Revision: 2367

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

Also, avoid looking up replicator multiple times.

Modified:
    trunk/neo/storage/handlers/replication.py

Modified: trunk/neo/storage/handlers/replication.py
==============================================================================
--- trunk/neo/storage/handlers/replication.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/replication.py [iso-8859-1] Fri Oct 29 19:41:23 2010
@@ -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:





More information about the Neo-report mailing list