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

fix(vertex): avoid credentials refresh on every request #575

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

RobertCraigie
Copy link
Collaborator

@RobertCraigie RobertCraigie commented Jul 3, 2024

Fixes #564. There will still be a delay for the first request but then the credentials will be cached.

I'm fairly nervous with this change will result in failures for certain cases as I'm not familiar enough with the google credentials system. Maybe we should ensure we try auth failures?

@RobertCraigie RobertCraigie requested a review from a team as a code owner July 3, 2024 10:02
Copy link
Contributor

@aaron-lerner aaron-lerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM and I had a coworker take a look to confirm as well. He pointed out that there may be a slight danger of tokens expiring mid-request. You can have some multi-minute requests if token counts are high enough, but I'm not sure exactly what the failure mode looks like if that happens. It also looks like the google auth lib gives a 3.75 min buffer, so I think this is fine.

Thanks for the quick fix!

@RobertCraigie
Copy link
Collaborator Author

thanks for the review! mid-request expiries is a good callout, that was my main concern as well, maybe we could perform our own expiry calculation with an even bigger skew? e.g. 10 mins as thats our default request timeout?

@RobertCraigie RobertCraigie merged commit eea1662 into next Jul 8, 2024
1 check passed
@RobertCraigie RobertCraigie deleted the robert/fix-unneeded-credentials-refresh branch July 8, 2024 08:16
@stainless-app stainless-app bot mentioned this pull request Jul 8, 2024
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 this pull request may close these issues.

2 participants