Merge lp:~cjwatson/ubuntu-archive-publishing/seed-timeout into lp:ubuntu-archive-publishing

Proposed by Colin Watson
Status: Merged
Merged at revision: 120
Proposed branch: lp:~cjwatson/ubuntu-archive-publishing/seed-timeout
Merge into: lp:ubuntu-archive-publishing
Diff against target: 42 lines (+7/-4)
1 file modified
scripts/maintenance-check.py (+7/-4)
To merge this branch: bzr merge lp:~cjwatson/ubuntu-archive-publishing/seed-timeout
Reviewer Review Type Date Requested Status
Benjamin Allot Approve
Ubuntu Package Archive Administrators Pending
Review via email: mp+426263@code.launchpad.net

Commit message

Add a timeout when fetching seed files.

To post a comment you must log in.
Revision history for this message
Benjamin Allot (ballot) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/maintenance-check.py'
2--- scripts/maintenance-check.py 2020-04-16 18:24:34 +0000
3+++ scripts/maintenance-check.py 2022-07-05 09:34:21 +0000
4@@ -293,6 +293,8 @@
5 # support timeframe tag used in the Packages file
6 SUPPORT_TAG = "Supported"
7
8+SEED_TIMEOUT = 15
9+
10
11 def get_binaries_for_source_pkg(srcname):
12 """Return all binary package names for the given source package name.
13@@ -374,8 +376,9 @@
14 :param version: Code name of the distribution version (e.g. lucid).
15 :return: List of strings with the structure file content
16 """
17- f = urllib2.urlopen("%s/%s.%s/structure" % (
18- BASE_URL, distroname, version))
19+ f = urllib2.urlopen(
20+ "%s/%s.%s/structure" % (BASE_URL, distroname, version),
21+ timeout=SEED_TIMEOUT)
22 structure = f.readlines()
23 f.close()
24 return structure
25@@ -410,7 +413,7 @@
26 seedurl = "%s/%s.%s/%s" % (BASE_URL, name, distro, seed)
27 logging.debug("looking for '%s'", seedurl)
28 try:
29- f = urllib2.urlopen(seedurl)
30+ f = urllib2.urlopen(seedurl, timeout=SEED_TIMEOUT)
31 for line in f:
32 # Ignore lines that are not package names (headers etc).
33 if line[0] < 'a' or line[0] > 'z':
34@@ -576,7 +579,7 @@
35 # now check the hints file that is used to overwrite
36 # the default seeds
37 try:
38- for line in urllib2.urlopen(hints_file):
39+ for line in urllib2.urlopen(hints_file, timeout=SEED_TIMEOUT):
40 line = line.strip()
41 if not line or line.startswith("#"):
42 continue

Subscribers

People subscribed via source and target branches