[Neo-report] r2153 gregory - in /trunk/neo: master/transactions.py storage/transactions.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 11 09:55:45 CEST 2010


Author: gregory
Date: Fri Jun 11 09:55:41 2010
New Revision: 2153

Log:
Register transaction's birth. (helps debugging)

Modified:
    trunk/neo/master/transactions.py
    trunk/neo/storage/transactions.py

Modified: trunk/neo/master/transactions.py
==============================================================================
--- trunk/neo/master/transactions.py [iso-8859-1] (original)
+++ trunk/neo/master/transactions.py [iso-8859-1] Fri Jun 11 09:55:41 2010
@@ -33,14 +33,16 @@ class Transaction(object):
         self._msg_id = None
         # uuid dict hold flag to known who has locked the transaction
         self._uuid_dict = {}
+        self._birth = time()
 
     def __repr__(self):
-        return "<%s(node=%r, tid=%r, oids=%r, uuids=%r) at %x>" % (
+        return "<%s(node=%r, tid=%r, oids=%r, uuids=%r, age=%.2fs) at %x>" % (
                 self.__class__.__name__,
                 self._node,
                 dump(self._tid),
                 [dump(x) for x in self._oid_list],
                 [dump(x) for x in self._uuid_dict],
+                time() - self._birth,
                 id(self),
         )
 

Modified: trunk/neo/storage/transactions.py
==============================================================================
--- trunk/neo/storage/transactions.py [iso-8859-1] (original)
+++ trunk/neo/storage/transactions.py [iso-8859-1] Fri Jun 11 09:55:41 2010
@@ -15,6 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
+from time import time
 from neo import logging
 from neo.util import dump
 
@@ -50,13 +51,15 @@ class Transaction(object):
         self._object_dict = {}
         self._transaction = None
         self._locked = False
+        self._birth = time()
 
     def __repr__(self):
-        return "<%s(tid=%r, uuid=%r, locked=%r)> at %x" % (
+        return "<%s(tid=%r, uuid=%r, locked=%r, age=%.2fs)> at %x" % (
             self.__class__.__name__,
             dump(self._tid),
             dump(self._uuid),
             self.isLocked(),
+            time() - self._birth,
             id(self),
         )
 





More information about the Neo-report mailing list