Commit 2d70542a authored by Andreas Tille's avatar Andreas Tille

Add one hour waiting time after Error 429

parent c5851729
......@@ -54,6 +54,7 @@ READMEDEBIANARCHIVE='/srv/blends.debian.org/www/_'+TDNAME+'/README.Debian.tar.xz
TARGETDIR=os.path.join(os.environ['HOME'],TDNAME)
SLEEPTIME=1
SLEEPUNTILRETRY=3600
debug=0
# do not clean dirs. FIXME: Find a method to detect removed repositories and clean this up here
......@@ -83,7 +84,12 @@ def output_metadata(subdir, metadata):
return None
for item in items:
if item['name'] in metadata:
file_info = project.repository_blob(item['id'])
try:
file_info = project.repository_blob(item['id'])
except gitlab.exceptions.GitlabGetError:
time.sleep(SLEEPUNTILRETRY)
print("Received GitlabGetError: 429 - Retry later ... waiting for %i seconds" % SLEEPUNTILRETRY )
file_info = project.repository_blob(item['id'])
content = base64.b64decode(file_info['content'])
if item['name'] == 'metadata':
ext = '.upstream'
......@@ -111,10 +117,6 @@ for group in blends_groups:
# projects = group.projects.list(page=1, per_page=10, order_by='name', sort='asc')
print("%s has %i projects (Blend name %s)" % (group.attributes['name'], len(projects), blend)) # group.attributes['id'], group.attributes['path']) # , group.attributes['description'], group.attributes['full_name'])
for pr in projects:
# it seems that 1 second sleeping does not help anyway - there seems to be a block for about 1 hour
# FIXME: try adding sleep(60) statements in the main loop or so
# For the moment wait for responses to https://lists.debian.org/debian-devel/2018/07/msg00119.html
# before implementing anything based on wild guessing
project = gl.projects.get(pr.attributes['id']) # without this extra get repository_tree() fails
name = project.attributes['name']
namedir = os.path.join(TARGETDIR, name[0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment