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

background token refresh #90

Open
superfell opened this issue Dec 8, 2023 · 2 comments · May be fixed by #95
Open

background token refresh #90

superfell opened this issue Dec 8, 2023 · 2 comments · May be fixed by #95

Comments

@superfell
Copy link

We're seeing that refreshing tokens from outside of a GCP env is slow, often around 1 second for us. Because of this we'd like to get the refresh done in background outside of the get_token call. This is possible but awkward currently as there's no direct way for a consumer to trigger refresh other than to call get_token in the last 20 seconds of the token lifetime.

Ideally the library would offer a background refresh option, or if not that, the ability to force a refresh.

I can put together a PR for either of these approaches if this is something you're interested in.

@djc
Copy link
Owner

djc commented Dec 11, 2023

This sounds interesting! (Out of curiosity, who's "we"?) Would it be enough for your use case to spawn a task on any token requests that happen shortly before the expiration? That seems like the simplest approach to me.

@superfell
Copy link
Author

We is the very small stealth startup I'm at. Yes, I was thinking of something along those lines. I'll put together a PR for it.

@superfell superfell linked a pull request Jan 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants