← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/retry-pcjs into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/retry-pcjs into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1190762 in Launchpad itself: "Package copies sometimes throw oopses if the bug closure hits a lock"
  https://bugs.launchpad.net/launchpad/+bug/1190762

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/retry-pcjs/+merge/173116

Make use of retry_error_types in PCJs to retry the job if a deadlock while updating a bugtask happens. lazr.jobrunner already has all of the logic necessary to support this change.
-- 
https://code.launchpad.net/~stevenk/launchpad/retry-pcjs/+merge/173116
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/retry-pcjs into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
--- lib/lp/soyuz/model/packagecopyjob.py	2013-06-20 05:50:00 +0000
+++ lib/lp/soyuz/model/packagecopyjob.py	2013-07-05 00:34:29 +0000
@@ -12,6 +12,7 @@
 
 from lazr.delegates import delegates
 from lazr.jobrunner.jobrunner import SuspendJobException
+from psycopg2.extensions import TransactionRollbackError
 from storm.locals import (
     Int,
     JSON,
@@ -267,6 +268,10 @@
     classProvides(IPlainPackageCopyJobSource)
     config = config.IPlainPackageCopyJobSource
     user_error_types = (CannotCopy,)
+    # Raised when closing bugs ends up hitting another process and
+    # deadlocking.
+    retry_error_types = (TransactionRollbackError,)
+    max_retries = 5
 
     @classmethod
     def _makeMetadata(cls, target_pocket, package_version,