Skip to content

Commit

Permalink
- CircleCI Upload Tests: trying to reduce more the risk of infinite …
Browse files Browse the repository at this point in the history
…loop on "wait_for_progress"
  • Loading branch information
afabiani authored and mattiagiupponi committed Feb 23, 2021
1 parent df2cea5 commit 70073c7
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions geonode/upload/tests/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,17 +419,22 @@ def upload_file(self, fname, final_check,
self.wait_for_progress(data.get('progress'))
final_check(check_name, resp, data)

def wait_for_progress(self, progress_url, wait_for_progress_cnt=0):
if progress_url:
resp = self.client.get(progress_url)
json_data = resp.json()
# "COMPLETE" state means done
if json_data.get('state', '') == 'RUNNING' and self.wait_for_progress_cnt < 300:
time.sleep(1.0)
self.wait_for_progress_cnt += 1
self.wait_for_progress(progress_url)
def wait_for_progress(self, progress_url):
try:
if progress_url:
resp = self.client.get(progress_url)
json_data = resp.json()
# "COMPLETE" state means done
if json_data and json_data.get('state', '') == 'RUNNING' and \
self.wait_for_progress_cnt < 100:
self.wait_for_progress_cnt += 1
self.wait_for_progress(progress_url)
else:
self.wait_for_progress_cnt = 0
else:
self.wait_for_progress_cnt = 0
except Exception:
self.wait_for_progress_cnt = 0

def temp_file(self, ext):
fd, abspath = tempfile.mkstemp(ext)
Expand Down

0 comments on commit 70073c7

Please sign in to comment.