Skip to content

⚡ Bolt: cache GCP Revisions client to avoid re-creation latency - #30

Merged
JulienBreux merged 1 commit into
mainfrom
bolt/optimize-revisions-client-caching-16560582138162413711
Jul 20, 2026
Merged

⚡ Bolt: cache GCP Revisions client to avoid re-creation latency#30
JulienBreux merged 1 commit into
mainfrom
bolt/optimize-revisions-client-caching-16560582138162413711

Conversation

@JulienBreux

Copy link
Copy Markdown
Owner

💡 What:

Implemented thread-safe lazy-initialization and caching of the GCP Revisions client wrapper in internal/run/api/service/revision/client.go.

🎯 Why:

Previously, the Revisions client was created, authorized, and closed on every single list request. In a fast-refreshing terminal UI, this caused repeated credential discovery and TLS/gRPC handshake overhead (~300ms latency per call).

📊 Impact:

  • Reduces latency of service revisions fetches by ~300ms on subsequent calls.
  • Avoids connection-establishment overhead and credentials-check filesystem queries.
  • Prevents connection cancellations if request contexts are canceled (using context.Background() for the shared client lifecycle).

🔬 Measurement:

Verified through a new unit test Client Reuse in internal/run/api/service/revision/revision_test.go which guarantees createRevisionsClient is invoked exactly once when Listing Revisions multiple times on the same GCPClient.


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

This commit implements a stateful GCPClient for GCP Cloud Run Revisions in
internal/run/api/service/revision/client.go. It adds a sync.Mutex and
RevisionsClientWrapper cache, lazily initializing and reusing the client across
successive calls.

This avoids credential discovery and TLS handshake/gRPC connection creation
on every list revisions request, cutting latency by ~300ms per call. A test is
added to ensure caching client reuse behavior doesn't regress.

Co-authored-by: JulienBreux <964330+JulienBreux@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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.

@JulienBreux
JulienBreux merged commit c2a06da into main Jul 20, 2026
7 checks passed
@JulienBreux
JulienBreux deleted the bolt/optimize-revisions-client-caching-16560582138162413711 branch July 20, 2026 12:20
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