summaryrefslogtreecommitdiffstats
path: root/bin/lts-missing-uploads.py
diff options
context:
space:
mode:
authorChris Lamb <lamby@debian.org>2016-08-04 17:49:13 +0000
committerChris Lamb <lamby@debian.org>2016-08-04 17:49:13 +0000
commitd79862f598be384de66a88b8d6c95e582732a0ea (patch)
treec3f3dab1b466dfe768bd0b888c47361733aeba9b /bin/lts-missing-uploads.py
parent071ee9aec6b2dbb90f65f8caf188b7a54c189bbe (diff)
lts-missing-uploads: parallelise downloads of announcements.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@43770 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/lts-missing-uploads.py')
-rwxr-xr-xbin/lts-missing-uploads.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/bin/lts-missing-uploads.py b/bin/lts-missing-uploads.py
index fadd92a4c6..79584d75d0 100755
--- a/bin/lts-missing-uploads.py
+++ b/bin/lts-missing-uploads.py
@@ -19,6 +19,7 @@ import re
import sys
import gzip
import datetime
+import eventlet
import requests
import dateutil.relativedelta
@@ -34,10 +35,15 @@ class LTSMissingUploads(object):
re_version = re.compile(r'^Version.*: (?P<version>.*)')
def __init__(self):
+ self.pool = eventlet.GreenPool(10)
self.session = requests.session()
def main(self, *args):
dlas = {}
+ def download(x):
+ self.info("{source}: parsing announcement from {url} ...", **x)
+ x.update(self.get_dla(x['url'])[0])
+ dlas[x['source']] = x
for idx in range(3):
dt = datetime.datetime.utcnow().replace(day=1) - \
@@ -49,15 +55,12 @@ class LTSMissingUploads(object):
dt.month,
)
+
# Prefer later DLAs with reversed(..)
for x in reversed(self.get_dlas(dt.year, dt.month)):
- # Only comment on the latest upload
- if x['source'] in dlas:
- continue
-
- self.info("{source}: parsing announcement from {url} ...", **x)
- x.update(self.get_dla(x['url'])[0])
- dlas[x['source']] = x
+ if x['source'] not in dlas:
+ self.pool.spawn_n(download, x)
+ self.pool.waitall()
if not dlas:
return 0
@@ -127,6 +130,8 @@ class LTSMissingUploads(object):
print("I: " + msg.format(*args, **kwargs), file=sys.stderr)
if __name__ == '__main__':
+ eventlet.monkey_patch(socket=True)
+
try:
sys.exit(LTSMissingUploads().main(*sys.argv[1:]))
except KeyboardInterrupt:

© 2014-2024 Faster IT GmbH | imprint | privacy policy