Open greybaron opened 3 months ago
You are correct, Py Func _get_sdk_build_number
performs a request to the endpoint to get the current Gigya SDK Build Number. This function is called only by 1 Py Func _cdc_api_request
, but that Py Func is itself called 3 times in the sequence as shown below:
_get_gigya_login_token
>_cdc_api_request
>_get_sdk_build_number
_get_uid
>_cdc_api_request
>_get_sdk_build_number
_get_id_token
>_cdc_api_request
>_get_sdk_build_number
The Py Func _get_gigya_login_token
is called first, so could set the global var pretty easily by appending 1 line before the final return, subsequent calls to the Py Func would then be caught by the existing if logic if GIGYA_SDK_BUILD_NUMBER is not None
.
def _get_sdk_build_number(api_key):
global GIGYA_SDK_BUILD_NUMBER
if GIGYA_SDK_BUILD_NUMBER is not None:
return GIGYA_SDK_BUILD_NUMBER
...
...
GIGYA_SDK_BUILD_NUMBER = build_number # line to append
return build_number
I'll try to look at testing this in future, it is very low on my todo backlog though so feel free to use above analysis and confirm, then a PR can be created.
Inside
sap_id_sso.py
is the following code:https://github.com/sap-linuxlab/community.sap_launchpad/blob/59ffb67531e4f62650b8910f83b1ca2c95cffcd4/plugins/module_utils/sap_id_sso.py#L200-L203
This seems to imply caching, however
GIGYA_SDK_BUILD_NUMBER
is never assigned to and always remainsNone
. Is there a reason for this? The only argument in that function is the API key, but as of now, for all three invocations it is the same.Considering the
gigya.js
is over 500 KB in size and the regex takes fairly long, caching would make sense. Perhaps that was the plan all along, but assigning to the global was forgotten?