Repository navigation
Share in-flight Azure token requests and run az CLI asynchronously - #1298
Merged
Merged
Conversation
Concurrent secret lookups now share one token request per resource, so the az CLI fallback runs once instead of once per secret. az runs via async spawn so it no longer blocks the event loop and times out other Key Vault requests. The CLI token cache is read from AZURE_CONFIG_DIR when set. Fixes #1275
Contributor
|
The changes in this PR will be included in the next version bump.
|
commit: |
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes: Reviewed token-request sharing, asynchronous Azure CLI execution, and the related tests and documentation.
- Token sharing: Concurrent lookups share an instance-local request per resource, with cleanup on success and failure.
- CLI fallback:
azruns asynchronously with the existing timeout and tenant scoping, using a shell on Windows. - Config directory: Token-cache reads honor
AZURE_CONFIG_DIR, with documentation updated accordingly. - Regression coverage: New tests verify one token acquisition for concurrent secrets. The plugin build, all 21 tests, and typecheck passed on Linux; Windows execution was not tested locally.
gpt-6.1-sol | 𝕏
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Fixes #1275.
When several secrets resolve at once with no cached token, each lookup ran its own token acquisition. With the Azure CLI fallback that meant one blocking
execSync('az account get-access-token ...')per secret, which stalled the event loop long enough for other Key Vault requests to hit their 10s timeout.getAccessTokennow shares one in-flight request per resource. The entry is cleared on success and failure, so expiry checks and retries still work.azruns through asyncspawnAsync(with a shell on Windows, whereazis a.cmdshim), so a slow CLI no longer blocks other requests.AZURE_CONFIG_DIRwhen set, matching whereazwrites them.Tests: three concurrent secrets with a service principal make one token request; with a fake
azon PATH and an empty config dir,azis called exactly once.Cross-process token caching (#1047) is left for later.