You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Problem:
The Identity team noticed a large spike in token refreshes for specific
users. One user would trigger refresh over 50 times within a few
seconds.
Ticket: `P180886632`
## Solution:
The telemetry showed that `getChatAuthState()` was being called many
times in a short period. This eventually triggered the token refresh
logic many times, if the token was expired.
The solution is to add a debounce to `getToken()` which calls the
refresh logic.
- `debounce()` only accepts functions without any args, the refresh
logic requires args
- `getToken()` will also load from disk is the token is not expired, so
debouncing here saves disk I/O as well.
The current debounce interval is 100 milliseconds, which based on
telemetry should be enough to capture the barrage of calls. With some
manual testing it does not feel like UX is impacted in any noticeable
way.
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Signed-off-by: nkomonen-amazon <[email protected]>
0 commit comments