Cache Faraday connection and auth tokens for improved performance#37
Open
stevenou wants to merge 2 commits intogbaptista:mainfrom
Open
Cache Faraday connection and auth tokens for improved performance#37stevenou wants to merge 2 commits intogbaptista:mainfrom
stevenou wants to merge 2 commits intogbaptista:mainfrom
Conversation
- Memoize Faraday connection to reuse HTTP connections across requests - Use apply! instead of fetch_access_token! to leverage googleauth's built-in token caching (only refreshes when token is missing or expires within 60 seconds) - Bump version to 4.3.0 This eliminates unnecessary per-request overhead: - No longer creates a new Faraday connection on every request - No longer fetches a new auth token on every request 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
apply!instead offetch_access_token!to leverage googleauth's built-in token caching (only refreshes when token is missing or expires within 60 seconds)Problem
The current implementation has two performance issues:
fetch_access_token!on every request (unnecessary network call to Google's auth service)Solution
@connectionand reused across all requests from a single client instance@authorizer.apply!(request.headers)instead of manually setting the Authorization header withfetch_access_token!. The googleauth gem'sapply!method has built-in token caching.Test plan
🤖 Generated with Claude Code