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 access-token on database access ⚠️ #117

Open
nikolaia opened this issue Nov 14, 2023 · 0 comments
Open

Cache access-token on database access ⚠️ #117

nikolaia opened this issue Nov 14, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@nikolaia
Copy link
Member

Caching and management of the lifespan for the Azure.Core.AccessToken is considered the responsibility of the caller: each call should request a fresh token being requested.

Right now we request a new token on every connection:

var token = await _credential.GetTokenAsync(tokenRequestContext, cancellationToken);

We are probably saved by connection-pooling but should reuse the token on the next connection opening if it's still valid.

PS: Remember to check if it's valid x seconds into future as there will be some delay from when we check the token expiration until the actual connection is made.

@nikolaia nikolaia added enhancement New feature or request good first issue Good for newcomers labels Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant