-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reduced number of requests to gv #10959
base: feature/gravy_valet_integration
Are you sure you want to change the base?
reduced number of requests to gv #10959
Conversation
a83eebb
to
5cc5d3e
Compare
def get_external_services(requesting_user): | ||
global _services | ||
if _services: | ||
return _services | ||
_services = [] | ||
for addon_type in gv_requests.AddonType: | ||
srv = [EphemeralAddonConfig(service) for service in gv_requests.iterate_gv_results( | ||
endpoint_url=gv_requests.ACCOUNT_EXTERNAL_SERVICE_ENDPOINT.format(addon_type=addon_type), | ||
requesting_user=requesting_user, | ||
)] | ||
_services += srv | ||
return _services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the _services
global variable here is an OSF-side cache for all the external services, correct? What's the lifetime of this cache? Does it exist for the lifetime of the WSGI app or for the lifetime of a single request?
@@ -47,7 +53,7 @@ def get_account(gv_account_pk, requesting_user): # -> JSONAPIResultEntry | |||
return get_gv_result( | |||
endpoint_url=ACCOUNT_ENDPOINT.format(pk=gv_account_pk), | |||
requesting_user=requesting_user, | |||
params={'include': ACCOUNT_EXTERNAL_SERVICE_PATH}, | |||
params={'include': ACCOUNT_EXTERNAL_STORAGE_SERVICE_PATH}, | |||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even use this get_account
hook anywhere? It seems to be only used previously in _get_addon_from_gv
of the user model and that hook was removed in this PR.
Purpose
Changes
QA Notes
Please make verification statements inspired by your code and what your code touches.
What are the areas of risk?
Any concerns/considerations/questions that development raised?
Documentation
Side Effects
Ticket