From 346981dd07f92657dc38036fe367ae2da5bf8506 Mon Sep 17 00:00:00 2001 From: wiro Date: Wed, 25 Mar 2020 12:18:56 +0100 Subject: [PATCH] Wait for gitlab export based on export_status, reset retries when gitlab is processing the request --- lib/gitlab.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/gitlab.py b/lib/gitlab.py index 777b3d3..69b922f 100644 --- a/lib/gitlab.py +++ b/lib/gitlab.py @@ -121,7 +121,8 @@ def project_export(self, project_path): r = self.__api_export(url_project_path) if ((float(r.status_code) >= 200) and (float(r.status_code) < 300)): # Api good, check for status - max_tries = 30 + max_tries_number = 10 + max_tries = max_tries_number s = "" status_export = False while max_tries != 0: @@ -145,6 +146,10 @@ def project_export(self, project_path): if s == "finished" and "_links" in json.keys(): status_export = True break + + if s == "queued" or s == "finished" or s == "started" or s == "regeneration_in_progress": + # Reset counter, we are waiting for export + max_tries = max_tries_number else: s = "unknown"