← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/recipe-timeouts into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/recipe-timeouts into lp:launchpad.

Commit message:
Expose Branch.markRecipesStale so that the branch scanner can avoid the decoration on Branch.recipes.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1425080 in Launchpad itself: "Person:+recipes timeouts"
  https://bugs.launchpad.net/launchpad/+bug/1425080

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/recipe-timeouts/+merge/250913

Expose Branch.markRecipesStale so that the branch scanner can avoid the decoration on Branch.recipes.  Fixes lots of buildbot failures.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/recipe-timeouts into lp:launchpad.
=== modified file 'lib/lp/code/interfaces/branch.py'
--- lib/lp/code/interfaces/branch.py	2014-04-10 11:56:54 +0000
+++ lib/lp/code/interfaces/branch.py	2015-02-25 12:49:54 +0000
@@ -652,6 +652,9 @@
     def scheduleDiffUpdates():
         """Create UpdatePreviewDiffJobs for this branch's targets."""
 
+    def markRecipesStale():
+        """Mark all recipes associated with this branch as stale."""
+
     def getStackedBranches():
         """The branches that are stacked on this one."""
 

=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py	2015-02-24 13:46:46 +0000
+++ lib/lp/code/model/branch.py	2015-02-25 12:49:54 +0000
@@ -619,6 +619,11 @@
                     merge_proposal, old.revision_id, new.revision_id)
         return jobs
 
+    def markRecipesStale(self):
+        """See `IBranch`."""
+        for recipe in self._recipes:
+            recipe.is_stale = True
+
     def addToLaunchBag(self, launchbag):
         """See `IBranch`."""
         launchbag.add(self.product)
@@ -1404,15 +1409,19 @@
         return can_access
 
     @property
+    def _recipes(self):
+        """Undecorated version of recipes for use by `markRecipesStale`."""
+        from lp.code.model.sourcepackagerecipedata import (
+            SourcePackageRecipeData,
+            )
+        return SourcePackageRecipeData.findRecipes(self)
+
+    @property
     def recipes(self):
         """See `IHasRecipes`."""
         from lp.code.model.sourcepackagerecipe import SourcePackageRecipe
-        from lp.code.model.sourcepackagerecipedata import (
-            SourcePackageRecipeData,
-            )
         hook = SourcePackageRecipe.preLoadDataForSourcePackageRecipes
-        return DecoratedResultSet(
-            SourcePackageRecipeData.findRecipes(self), pre_iter_hook=hook)
+        return DecoratedResultSet(self._recipes, pre_iter_hook=hook)
 
     merge_queue_id = Int(name='merge_queue', allow_none=True)
     merge_queue = Reference(merge_queue_id, 'BranchMergeQueue.id')

=== modified file 'lib/lp/codehosting/scanner/bzrsync.py'
--- lib/lp/codehosting/scanner/bzrsync.py	2013-11-14 08:28:31 +0000
+++ lib/lp/codehosting/scanner/bzrsync.py	2015-02-25 12:49:54 +0000
@@ -322,5 +322,4 @@
 
 
 def update_recipes(tip_changed):
-    for recipe in tip_changed.db_branch.recipes:
-        recipe.is_stale = True
+    tip_changed.db_branch.markRecipesStale()


Follow ups