-
Notifications
You must be signed in to change notification settings - Fork 39
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 the AccessToken for console session to speed up successive command requests #120
Conversation
CHANGELOG.md
Outdated
## [1.16.4](https://github.com/Microsoft/StoreBroker/tree/1.16.4) - (2018/04/23) | ||
### Fixes: | ||
|
||
- Removed checks validation checks preventing some apps from updating | ||
- Removed checks validation checks prevented some apps from updating | ||
gaming options or trailers. The API now enables all apps to use |
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.
This sentence doesn't make much sense..
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.
agreed. fixed.
$script:lastAccessToken = $null | ||
|
||
# Indicates when $script:lastAccessToken has expired and must be refreshed | ||
$script:lastAccessTokenExpirationDate = Get-Date |
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.
This works but [DateTime] 0
seems more like a $null
equivalent.
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.
Interesting. Wasn't aware of that. Will leave this as-is however, as the code seems more clear/obvious if i'm saying "it expires right now"
|
||
if ($PSCmdlet.ShouldProcess("", "Clear cached access token")) | ||
{ | ||
$script:lastAccessToken = $null |
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 you need to reset $script:lastAccessTokenExpirationDate
? Maybe this logic should move to a Clear-AccessToken
function?
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.
We only ever use the access token if it's non-null. Will consider this feedback however.
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.
Decided to won't fix this.
…and requests Sped up the module for users not using a Proxy. `AccessToken` is now cached for the duration of the console session, and only needs to be refreshed when it expires (which is about every 60 minutes). Previously, the access token was only cached for the duration of the currently executing command, which meant that any succesive interactions at the commandline required a new `AccessToken` to be acquired.
Sped up the module for users not using a Proxy.
AccessToken
is now cached for theduration of the console session, and only needs to be refreshed when it expires (which is about
every 60 minutes). Previously, the access token was only cached for the duration of the currently
executing command, which meant that any succesive interactions at the commandline required a new
AccessToken
to be acquired.