Commit 3e2e7851 authored by Tristan Cavelier's avatar Tristan Cavelier

XXX Add start timestamp to manage_debug_thread SQL queries

parent 9d08cb2c
...@@ -69,7 +69,9 @@ def dump_threads(): ...@@ -69,7 +69,9 @@ def dump_threads():
while f is not None: while f is not None:
code = f.f_code code = f.f_code
if code is DB._query.func_code: if code is DB._query.func_code:
mysql_info = "\nMySQL query:\n%s\n" % f.f_locals['query'] mysql_info = "\nMySQL query - %s:\n%s\n" % (
getattr(f.f_locals['self'], "_start_time", ""),
f.f_locals['query'])
break break
f = f.f_back f = f.f_back
except ImportError: except ImportError:
......
...@@ -107,6 +107,7 @@ from Shared.DC.ZRDB.TM import TM ...@@ -107,6 +107,7 @@ from Shared.DC.ZRDB.TM import TM
from DateTime import DateTime from DateTime import DateTime
from zLOG import LOG, ERROR from zLOG import LOG, ERROR
from ZODB.POSException import ConflictError from ZODB.POSException import ConflictError
import time
import sys import sys
...@@ -321,6 +322,7 @@ class DB(TM): ...@@ -321,6 +322,7 @@ class DB(TM):
because they are bound to the connection. This check can be because they are bound to the connection. This check can be
overridden by passing force_reconnect with True value. overridden by passing force_reconnect with True value.
""" """
self._start_time = time.time()
try: try:
self.db.query(query) self.db.query(query)
except OperationalError, m: except OperationalError, m:
......
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