This repository was archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 448
Refactoring methods to prevent double loading of data #640
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Operational methods call the validation methods to validate data before they do their job. The validation methods load the requisite data and validate them. The operational methods then load the same data items and continue. In order to reduce the re-querying the validation methods now load the data, validate the data and returns the data if valid. Refactoring method `LoadKeychainInternal`/`ValidateKeychain` to `GetValidatedKeychainAdaper` Refactoring method `GetCurrentUserInternal` to `GetValidatedGitHubUser`
9f3c1b2 to
57fe7ef
Compare
Contributor
Author
|
I'm going to put a bit more into the explanation and resolution of this problem. |
Credential might be null and we should be loading if there is no token
- LoadKeychainInternal is only called from ValidateKeychain - ValidateKeychain should throw a TokenUsernameMismatchException if it can see the user does not match
…n-missing-exception # Conflicts: # src/GitHub.Api/Application/ApiClient.cs # src/GitHub.Api/Authentication/Keychain.cs
shana
approved these changes
Apr 3, 2018
Member
shana
left a comment
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.
I had a bunch of comments on this that I've translated into fixes in #667
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DO NOT MERGE: This is part of #663
Depends on:
The validation methods
ValidateKeychainandValidateCurrentUserInternalload the requisite data and validate them. The methods that are calling these methods perform the same tasks to load the same data items and continue.In order to reduce the re-querying the validation methods now load the data, validate the data and returns the data if valid or throw an exception if invalid as previously expected.
Refactoring method
LoadKeychainInternal/ValidateKeychaintoGetValidatedKeychainAdaperRefactoring method
ValidateCurrentUserInternal/GetCurrentUserInternaltoGetValidatedGitHubUser