Skip to content

⚡ Bolt: Reuse GCP clients and credentials#19

Open
JulienBreux wants to merge 2 commits into
mainfrom
bolt/reuse-gcp-clients-and-credentials-2076069182797942206
Open

⚡ Bolt: Reuse GCP clients and credentials#19
JulienBreux wants to merge 2 commits into
mainfrom
bolt/reuse-gcp-clients-and-credentials-2076069182797942206

Conversation

@JulienBreux

Copy link
Copy Markdown
Owner

Implement lazy-initialization and caching for GCP clients across all API packages to significantly reduce latency and redundant authentication, especially for multi-regional operations.


PR created automatically by Jules for task 2076069182797942206 started by @JulienBreux

Implement lazy-initialization and caching for GCP clients across all API packages.

Initializing a new GCP client for every API call is expensive due to credential discovery and connection handshakes. By caching and reusing the clients within each GCPClient struct, we significantly reduce latency and redundant authentication, particularly during concurrent regional requests.

Changes:
- Added sync.Mutex and client field to GCPClient in service, job, execution, workerpool, domainmapping, and project packages.
- Implemented thread-safe get*Client methods for lazy-initialization.
- Removed redundant Close() calls in individual API methods to maintain persistent connections.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

- Implement lazy-initialization and caching for GCP clients across all API packages.
- Fix GitHub CI by using --snapshot in GoReleaser for pull requests.

Initializing a new GCP client for every API call is expensive due to credential discovery and connection handshakes. By caching and reusing the clients within each GCPClient struct, we significantly reduce latency and redundant authentication, particularly during concurrent regional requests.

The GoReleaser fix prevents 'git tag was not made against commit' errors in pull requests by using snapshot mode.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
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.

1 participant