Skip to content

Commit 5cce316

Browse files
committed
return response from call_finished()
1 parent 96aeefc commit 5cce316

File tree

1 file changed

+7
-4
lines changed
  • tools/src/main/python/opengrok_tools/utils

1 file changed

+7
-4
lines changed

tools/src/main/python/opengrok_tools/utils/restful.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def call_finished(location_uri, headers, timeout):
3939
:param location_uri: URI to check the status of API call
4040
:param headers: HTTP headers
4141
:param timeout: connect timeout
42+
:return indication and response tuple
4243
"""
4344
logger = logging.getLogger(__name__)
4445

@@ -49,9 +50,9 @@ def call_finished(location_uri, headers, timeout):
4950

5051
response.raise_for_status()
5152
if response.status_code == 202:
52-
return False
53+
return False, response
5354
else:
54-
return True
55+
return True, response
5556

5657

5758
def wait_for_async_api(response, api_timeout=None, headers=None, timeout=None):
@@ -71,12 +72,14 @@ def wait_for_async_api(response, api_timeout=None, headers=None, timeout=None):
7172
start_time = time.time()
7273
if api_timeout is None:
7374
while True:
74-
if call_finished(location_uri, headers, timeout):
75+
done, response = call_finished(location_uri, headers, timeout)
76+
if done:
7577
break
7678
time.sleep(1)
7779
else:
7880
for _ in range(api_timeout):
79-
if call_finished(location_uri, headers, timeout):
81+
done, response = call_finished(location_uri, headers, timeout)
82+
if done:
8083
break
8184
time.sleep(1)
8285

0 commit comments

Comments
 (0)