launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #32374
[Merge] ~ilkeremrekoc/launchpad:enable-all-recipe-links into launchpad:master
İlker Emre Koç has proposed merging ~ilkeremrekoc/launchpad:enable-all-recipe-links into launchpad:master.
Commit message:
Enable all recipe links
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ilkeremrekoc/launchpad/+git/launchpad/+merge/484374
The dynamic enablement of recipe links use a auto generated query, that
is slow and complex, resulting in unnecessary computation and timeouts.
Thus, enabling all the links from the get go would eliminate timeouts
on profiles, projects and teams.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ilkeremrekoc/launchpad:enable-all-recipe-links into launchpad:master.
diff --git a/lib/lp/charms/browser/hascharmrecipes.py b/lib/lp/charms/browser/hascharmrecipes.py
index 854f269..a10571e 100644
--- a/lib/lp/charms/browser/hascharmrecipes.py
+++ b/lib/lp/charms/browser/hascharmrecipes.py
@@ -26,11 +26,18 @@ class HasCharmRecipesMenuMixin:
def view_charm_recipes(self):
text = "View charm recipes"
- enabled = (
- not getUtility(ICharmRecipeSet)
- .findByContext(self.context, visible_by_user=self.user)
- .is_empty()
- )
+
+ # The dynamic link enablement uses a query too complex to be useful
+ # So we disable it for now, for all recipe types:
+ # snap, charm, source, rock and oci
+ enabled = True
+
+ # enabled = (
+ # not getUtility(ICharmRecipeSet)
+ # .findByContext(self.context, visible_by_user=self.user)
+ # .is_empty()
+ # )
+
return Link("+charm-recipes", text, icon="info", enabled=enabled)
def create_charm_recipe(self):
diff --git a/lib/lp/code/browser/sourcepackagerecipelisting.py b/lib/lp/code/browser/sourcepackagerecipelisting.py
index 07b06e7..3337b15 100644
--- a/lib/lp/code/browser/sourcepackagerecipelisting.py
+++ b/lib/lp/code/browser/sourcepackagerecipelisting.py
@@ -22,9 +22,14 @@ class HasRecipesMenuMixin:
def view_recipes(self):
text = "View source package recipes"
- enabled = False
- if self.context.recipes.count():
- enabled = True
+
+ # The dynamic link enablement uses a query too complex to be useful
+ # So we disable it for now, for all recipe types:
+ # snap, charm, source, rock and oci
+ enabled = True
+
+ # if self.context.recipes.count():
+ # enabled = True
return Link(
"+recipes", text, icon="info", enabled=enabled, site="code"
)
diff --git a/lib/lp/oci/browser/hasocirecipes.py b/lib/lp/oci/browser/hasocirecipes.py
index efb92aa..7316a9c 100644
--- a/lib/lp/oci/browser/hasocirecipes.py
+++ b/lib/lp/oci/browser/hasocirecipes.py
@@ -7,9 +7,9 @@ __all__ = [
"HasOCIRecipesMenuMixin",
]
-from zope.component import getUtility
+# from zope.component import getUtility
-from lp.oci.interfaces.ocirecipe import IOCIRecipeSet
+# from lp.oci.interfaces.ocirecipe import IOCIRecipeSet
from lp.services.webapp import Link
@@ -19,9 +19,15 @@ class HasOCIRecipesMenuMixin:
def view_oci_recipes(self):
target = "+oci-recipes"
text = "View OCI recipes"
- enabled = (
- not getUtility(IOCIRecipeSet)
- .findByContext(self.context, visible_by_user=self.user)
- .is_empty()
- )
+
+ # The dynamic link enablement uses a query too complex to be useful
+ # So we disable it for now, for all recipe types:
+ # snap, charm, source, rock and oci
+ enabled = True
+
+ # enabled = (
+ # not getUtility(IOCIRecipeSet)
+ # .findByContext(self.context, visible_by_user=self.user)
+ # .is_empty()
+ # )
return Link(target, text, enabled=enabled, icon="info")
diff --git a/lib/lp/rocks/browser/hasrockrecipes.py b/lib/lp/rocks/browser/hasrockrecipes.py
index c88e33b..7234e23 100644
--- a/lib/lp/rocks/browser/hasrockrecipes.py
+++ b/lib/lp/rocks/browser/hasrockrecipes.py
@@ -21,11 +21,17 @@ class HasRockRecipesMenuMixin:
def view_rock_recipes(self):
text = "View rock recipes"
- enabled = (
- not getUtility(IRockRecipeSet)
- .findByContext(self.context, visible_by_user=self.user)
- .is_empty()
- )
+
+ # The dynamic link enablement uses a query too complex to be useful
+ # So we disable it for now, for all recipe types:
+ # snap, charm, source, rock and oci
+ enabled = True
+
+ # enabled = (
+ # not getUtility(IRockRecipeSet)
+ # .findByContext(self.context, visible_by_user=self.user)
+ # .is_empty()
+ # )
return Link("+rock-recipes", text, icon="info", enabled=enabled)
diff --git a/lib/lp/snappy/browser/hassnaps.py b/lib/lp/snappy/browser/hassnaps.py
index 7e4b5a4..b112ea0 100644
--- a/lib/lp/snappy/browser/hassnaps.py
+++ b/lib/lp/snappy/browser/hassnaps.py
@@ -25,11 +25,17 @@ class HasSnapsMenuMixin:
context = self.context
if isinstance(context, DecoratedBranch):
context = context.branch
- enabled = (
- not getUtility(ISnapSet)
- .findByContext(context, visible_by_user=self.user)
- .is_empty()
- )
+
+ # The dynamic link enablement uses a query too complex to be useful
+ # So we disable it for now, for all recipe types:
+ # snap, charm, source, rock and oci
+ enabled = True
+
+ # enabled = (
+ # not getUtility(ISnapSet)
+ # .findByContext(context, visible_by_user=self.user)
+ # .is_empty()
+ # )
return Link("+snaps", text, icon="info", enabled=enabled)
def create_snap(self):