← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~lifeless/launchpad/cp into lp:~launchpad-pqm/launchpad/production-devel

 

Robert Collins has proposed merging lp:~lifeless/launchpad/cp into lp:~launchpad-pqm/launchpad/production-devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


Fix the cause of 'could not connect to launchpad' errors on some timeouts : critical because this lets them be logged properly, and generate OOPS properly, so we can see them in our stats.
-- 
https://code.launchpad.net/~lifeless/launchpad/cp/+merge/35364
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~lifeless/launchpad/cp into lp:~launchpad-pqm/launchpad/production-devel.
=== modified file 'lib/canonical/launchpad/webapp/adapter.py'
--- lib/canonical/launchpad/webapp/adapter.py	2010-09-01 08:48:55 +0000
+++ lib/canonical/launchpad/webapp/adapter.py	2010-09-14 05:19:47 +0000
@@ -484,6 +484,14 @@
             super(LaunchpadTimeoutTracer, self).connection_raw_execute(
                 connection, raw_cursor, statement, params)
         except TimeoutError:
+            # XXX bug=636801 Robert Colins 20100914 This is duplicated from the
+            # statement tracer, because the tracers are not arranged in a stack
+            # rather a queue: the done-code in the statement tracer never runs.
+            action = getattr(connection, '_lp_statement_action', None)
+            if action is not None:
+                # action may be None if the tracer was installed after the
+                # statement was submitted.
+                action.finish()
             info = sys.exc_info()
             transaction.doom()
             OpStats.stats['timeouts'] += 1
@@ -545,8 +553,8 @@
                                        statement, params):
         action = getattr(connection, '_lp_statement_action', None)
         if action is not None:
-            # action may be None if the tracer was installed  the statement was
-            # submitted.
+            # action may be None if the tracer was installed after the
+            # statement was submitted.
             action.finish()
 
     def connection_raw_execute_error(self, connection, raw_cursor,

=== modified file 'lib/lp/services/timeline/timedaction.py'
--- lib/lp/services/timeline/timedaction.py	2010-09-06 22:41:18 +0000
+++ lib/lp/services/timeline/timedaction.py	2010-09-14 05:19:47 +0000
@@ -43,6 +43,9 @@
         self.detail = detail
         self.timeline = timeline
 
+    def __repr__(self):
+        return "<TimedAction %s[%s]>" % (self.category, self.detail[:20])
+
     def logTuple(self):
         """Return a 4-tuple suitable for errorlog's use."""
         offset = self._td_to_ms(self.start - self.timeline.baseline)