[PR #317] [MERGED] fix(gRPC): Cache descriptor pools to avoid re-reflection; add manual “Refresh Schema” to force re-fetch #239

Closed
opened 2025-12-29 07:20:00 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mountain-loop/yaak/pull/317
Author: @Nokinori
Created: 12/9/2025
Status: Merged
Merged: 12/10/2025
Merged by: @gschier

Base: mainHead: nokinori/fix-grpc-server-reflection-cache


📝 Commits (3)

  • 5b89807 fix: cache descriptor pools to avoid re-reflection
  • 4c23c60 Simplify refetch logic
  • be64b30 Fix loading state

📊 Changes

3 files changed (+31 additions, -6 deletions)

View changed files

📝 src-tauri/src/lib.rs (+2 -0)
📝 src-tauri/yaak-grpc/src/manager.rs (+24 -5)
📝 src-web/hooks/useGrpc.ts (+5 -1)

📄 Description

Hi! Firstly, thanks for Yaak, it’s a great tool!
I’m new to the codebase. If I got anything wrong or missed some edge cases please let me know.

While working with gRPC via server reflection, I noticed that descriptor pools were being rebuilt on every request, so I tried to fix that.

Summary:

  • Fixes repeated gRPC server reflection on every request by caching descriptor pools and only reflecting when needed.
  • Adds a manual “Refresh Schema” control that invalidates the cache and re-fetches descriptors on demand.

Problem:
Previously, the app rebuilt the DescriptorPool via server reflection on every call to services()/connect(). This caused extra latency and the log “Fetching descriptors for …” to appear on every request. Users also needed a way to force a schema refresh when backend services change.

Behavior now with server reflection (no *.proto files selected):

  • First load reflects and caches descriptors.
  • Subsequent requests reuse the cached pool, so no repeated “Fetching descriptors for …” logs.
  • Clicking “Refresh Schema” invalidates the cache and re-runs reflection immediately; services update accordingly.

Behavior is the same except caching reduces redundant reflection. Manual refresh path uses existing code paths after invalidation.

Issue Link: https://feedback.yaak.app/p/ability-to-disable-automatic-schema-introspection-and-reload-schema-on/comment/693867cb4b3c6b0af1c4b272


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mountain-loop/yaak/pull/317 **Author:** [@Nokinori](https://github.com/Nokinori) **Created:** 12/9/2025 **Status:** ✅ Merged **Merged:** 12/10/2025 **Merged by:** [@gschier](https://github.com/gschier) **Base:** `main` ← **Head:** `nokinori/fix-grpc-server-reflection-cache` --- ### 📝 Commits (3) - [`5b89807`](https://github.com/mountain-loop/yaak/commit/5b89807057bf7db9e566ac566fbc23f5a1cdddf7) fix: cache descriptor pools to avoid re-reflection - [`4c23c60`](https://github.com/mountain-loop/yaak/commit/4c23c609367a1ce6fede1fb1d12156edacd19bab) Simplify refetch logic - [`be64b30`](https://github.com/mountain-loop/yaak/commit/be64b30924524cc7fef7f54b65cf57f50d1de0f3) Fix loading state ### 📊 Changes **3 files changed** (+31 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/lib.rs` (+2 -0) 📝 `src-tauri/yaak-grpc/src/manager.rs` (+24 -5) 📝 `src-web/hooks/useGrpc.ts` (+5 -1) </details> ### 📄 Description Hi! Firstly, thanks for Yaak, it’s a great tool! I’m new to the codebase. If I got anything wrong or missed some edge cases please let me know. While working with gRPC via server reflection, I noticed that descriptor pools were being rebuilt on every request, so I tried to fix that. Summary: - Fixes repeated gRPC server reflection on every request by caching descriptor pools and only reflecting when needed. - Adds a manual “Refresh Schema” control that invalidates the cache and re-fetches descriptors on demand. Problem: Previously, the app rebuilt the DescriptorPool via server reflection on every call to services()/connect(). This caused extra latency and the log “Fetching descriptors for …” to appear on every request. Users also needed a way to force a schema refresh when backend services change. Behavior now with server reflection (no *.proto files selected): - First load reflects and caches descriptors. - Subsequent requests reuse the cached pool, so no repeated “Fetching descriptors for …” logs. - Clicking “Refresh Schema” invalidates the cache and re-runs reflection immediately; services update accordingly. Behavior is the same except caching reduces redundant reflection. Manual refresh path uses existing code paths after invalidation. Issue Link: https://feedback.yaak.app/p/ability-to-disable-automatic-schema-introspection-and-reload-schema-on/comment/693867cb4b3c6b0af1c4b272 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 07:20:00 +01:00
adam closed this issue 2025-12-29 07:20:00 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/yaak#239