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

Cache if package maintainer is an author of the package to avoid multiple API calls #13111

Merged
merged 1 commit into from
Jul 18, 2022

Conversation

zeusongit
Copy link
Contributor

Purpose

https://jira.autodesk.com/browse/DYN-5103

When a user right clicks a package in Dynamo package manager preference tab, we check if the user is an author of that package or not in order to enable/disable Deprecate/Undeprecate option for that package.

Created a cache in Dynamo to record the result so that we do not call the API again and again for one session.

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated

Release Notes

Created a cache in Dynamo to record the result so that we do not call the API again and again for one session.

Reviewers

@QilongTang

@zeusongit zeusongit changed the title Update PackageManagerClient.cs Cache if package maintainer is an author of the package to avoid multiple API calls Jul 14, 2022
@mjkkirschner
Copy link
Member

do we check this again / refresh if the user logs out / logs in as another user?

@zeusongit
Copy link
Contributor Author

do we check this again / refresh if the user logs out / logs in as another user?

Not tested that scenario in revit, but it will break in that case, as Dictionary will have stale values.
Can user remain in Dynamo and logout? Because if it needs a restart then this could work.
I will test this and update.

@zeusongit
Copy link
Contributor Author

zeusongit commented Jul 14, 2022

I checked in Revit, we cannot sign out without quitting, not sure about other integrators. @mjkkirschner

Screen Shot 2022-07-14 at 4 03 39 PM
.

Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM does it make sense to add a unit test for this update?

@zeusongit
Copy link
Contributor Author

LGTM does it make sense to add a unit test for this update?

Unit test is not helpful, as we call the parent method for result, internally it uses cached or API response, with no way of knowing the difference.

@QilongTang QilongTang added this to the 2.16.0 milestone Jul 18, 2022
@zeusongit zeusongit merged commit 2232793 into DynamoDS:master Jul 18, 2022
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.

3 participants