Commit 00381074 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Register transaction's birth. (helps debugging)

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2153 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent efea73eb
......@@ -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),
)
......
......@@ -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),
)
......
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