diff --git a/crates-tauri/yaak-app/src/lib.rs b/crates-tauri/yaak-app/src/lib.rs index 70378f1e..a1d89afa 100644 --- a/crates-tauri/yaak-app/src/lib.rs +++ b/crates-tauri/yaak-app/src/lib.rs @@ -189,7 +189,6 @@ async fn cmd_grpc_reflect( request_id: &str, environment_id: Option<&str>, proto_files: Vec, - skip_cache: Option, window: WebviewWindow, app_handle: AppHandle, grpc_handle: State<'_, Mutex>, @@ -224,18 +223,21 @@ async fn cmd_grpc_reflect( let settings = window.db().get_settings(); let client_certificate = find_client_certificate(req.url.as_str(), &settings.client_certificates); + let proto_files: Vec = + proto_files.iter().map(|p| PathBuf::from_str(p).unwrap()).collect(); - Ok(grpc_handle - .lock() - .await + // Always invalidate cached pool when this command is called, to force re-reflection + let mut handle = grpc_handle.lock().await; + handle.invalidate_pool(&req.id, &uri, &proto_files); + + Ok(handle .services( &req.id, &uri, - &proto_files.iter().map(|p| PathBuf::from_str(p).unwrap()).collect(), + &proto_files, &metadata, workspace.setting_validate_certificates, client_certificate, - skip_cache.unwrap_or(false), ) .await .map_err(|e| GenericError(e.to_string()))?) diff --git a/crates/yaak-grpc/src/manager.rs b/crates/yaak-grpc/src/manager.rs index bd1dd17a..dd2c1c53 100644 --- a/crates/yaak-grpc/src/manager.rs +++ b/crates/yaak-grpc/src/manager.rs @@ -340,10 +340,9 @@ impl GrpcHandle { metadata: &BTreeMap, validate_certificates: bool, client_cert: Option, - skip_cache: bool, ) -> Result> { // Ensure we have a pool; reflect only if missing - if skip_cache || self.get_pool(id, uri, proto_files).is_none() { + if self.get_pool(id, uri, proto_files).is_none() { info!("Reflecting gRPC services for {} at {}", id, uri); self.reflect(id, uri, proto_files, metadata, validate_certificates, client_cert) .await?; diff --git a/src-web/hooks/useGrpc.ts b/src-web/hooks/useGrpc.ts index cf2859ad..67bd33cb 100644 --- a/src-web/hooks/useGrpc.ts +++ b/src-web/hooks/useGrpc.ts @@ -54,7 +54,7 @@ export function useGrpc( queryFn: () => { const environmentId = jotaiStore.get(activeEnvironmentIdAtom); return minPromiseMillis( - invokeCmd('cmd_grpc_reflect', { requestId, protoFiles, environmentId, skipCache: true }), + invokeCmd('cmd_grpc_reflect', { requestId, protoFiles, environmentId }), 300, ); },