Merge ~ines-almeida/launchpad:fix-pro-enable-infer-function into launchpad:master

Proposed by Ines Almeida
Status: Merged
Approved by: Ines Almeida
Approved revision: f43fd94461b6bf3c8219fb5d6e7ad234b3cdfcef
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~ines-almeida/launchpad:fix-pro-enable-infer-function
Merge into: launchpad:master
Diff against target: 56 lines (+10/-10)
2 files modified
lib/lp/scripts/garbo.py (+5/-9)
lib/lp/snappy/model/snap.py (+5/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+454716@code.launchpad.net

Commit message

Add override_timeout function to inferProEnable

Description of the change

The snap builds are currently failing due to the default timeout being `None`. This ensures a value exists in the builds

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/scripts/garbo.py b/lib/lp/scripts/garbo.py
2index bd3cfef..61cd51b 100644
3--- a/lib/lp/scripts/garbo.py
4+++ b/lib/lp/scripts/garbo.py
5@@ -112,7 +112,6 @@ from lp.services.scripts.base import (
6 SilentLaunchpadScriptFailure,
7 )
8 from lp.services.session.model import SessionData
9-from lp.services.timeout import override_timeout
10 from lp.services.verification.model.logintoken import LoginToken
11 from lp.services.webapp.publisher import canonical_url
12 from lp.services.webhooks.interfaces import IWebhookJobSource
13@@ -2284,14 +2283,11 @@ class SnapProEnablePopulator(TunableLoop):
14 return self.findSnaps().is_empty()
15
16 def __call__(self, chunk_size):
17- with override_timeout(300.0):
18- snaps = list(self.findSnaps()[:chunk_size])
19- for snap in snaps:
20- snap._pro_enable = getUtility(ISnapSet).inferProEnable(
21- snap.source
22- )
23- self.start_at = snaps[-1].id + 1
24- transaction.commit()
25+ snaps = list(self.findSnaps()[:chunk_size])
26+ for snap in snaps:
27+ snap._pro_enable = getUtility(ISnapSet).inferProEnable(snap.source)
28+ self.start_at = snaps[-1].id + 1
29+ transaction.commit()
30
31
32 class BaseDatabaseGarbageCollector(LaunchpadCronScript):
33diff --git a/lib/lp/snappy/model/snap.py b/lib/lp/snappy/model/snap.py
34index 42c1cee..c475075 100644
35--- a/lib/lp/snappy/model/snap.py
36+++ b/lib/lp/snappy/model/snap.py
37@@ -128,6 +128,7 @@ from lp.services.job.model.job import Job
38 from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
39 from lp.services.openid.adapters.openid import CurrentOpenIDEndPoint
40 from lp.services.propertycache import cachedproperty, get_property_cache
41+from lp.services.timeout import default_timeout
42 from lp.services.webapp.authorization import precache_permission_for_objects
43 from lp.services.webapp.interfaces import ILaunchBag
44 from lp.services.webapp.publisher import canonical_url
45@@ -1662,7 +1663,10 @@ class SnapSet:
46 return False
47
48 try:
49- snapcraft_data = self.getSnapcraftYaml(context)
50+ # Ensure there is a reasonable timeout set. Without this, the
51+ # default in snap builds would be 'None', which we don't want.
52+ with default_timeout(300.0):
53+ snapcraft_data = self.getSnapcraftYaml(context)
54 except (
55 MissingSnapcraftYaml,
56 CannotFetchSnapcraftYaml,

Subscribers

People subscribed via source and target branches

to status/vote changes: