Skip to content
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

Open
wants to merge 3 commits into
base: feature/gravy_valet_integration
Choose a base branch
from

Conversation

opaduchak
Copy link
Contributor

Purpose

Changes

QA Notes

Please make verification statements inspired by your code and what your code touches.

  • Verify
  • Verify

What are the areas of risk?

Any concerns/considerations/questions that development raised?

Documentation

Side Effects

Ticket

Comment on lines +40 to +51
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
Copy link
Collaborator

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},
)
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants