Skip to content

Commit 77181bf

Browse files
committed
change timeout keys, allow to set connect/read API timeout
1 parent 1bfc455 commit 77181bf

File tree

1 file changed

+8
-3
lines changed
  • tools/src/main/python/opengrok_tools/utils

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ def call_rest_api(call, substitutions=None, http_headers=None, timeout=None, api
189189
:param substitutions: dictionary of pattern:value for command and/or
190190
data substitution
191191
:param http_headers: optional dictionary of HTTP headers to be appended
192-
:param timeout: optional timeout in seconds for API call response
193-
:param api_timeout: optional timeout in seconds for asynchronous API call
192+
:param timeout: optional connect/read timeout in seconds for API call
193+
:param api_timeout: optional timeout in seconds for total duration of asynchronous API call
194194
:return value from given requests method
195195
"""
196196

@@ -208,9 +208,14 @@ def call_rest_api(call, substitutions=None, http_headers=None, timeout=None, api
208208
uri = subst(uri, substitutions)
209209
logger.debug(f"URI after the substitutions: {uri}")
210210

211+
call_timeout = call.get("timeout")
212+
if call_timeout:
213+
logger.debug(f"Setting connect/read API timeout based on the call to {call_timeout}")
214+
timeout = call_timeout
215+
211216
call_api_timeout = call.get("api_timeout")
212217
if call_api_timeout:
213-
logger.debug(f"Setting API timeout based on the call to {call_api_timeout}")
218+
logger.debug(f"Setting async API timeout based on the call to {call_api_timeout}")
214219
api_timeout = call_api_timeout
215220

216221
if data:

0 commit comments

Comments
 (0)