MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / refresh_draft_chunks

Function refresh_draft_chunks

crates/openshell-tui/src/lib.rs:2398–2425  ·  view source on GitHub ↗
(app: &mut App)

Source from the content-addressed store, hash-verified

2396}
2397
2398async fn refresh_draft_chunks(app: &mut App) {
2399 let sandbox_name = match app.selected_sandbox_name() {
2400 Some(name) => name.to_string(),
2401 None => return,
2402 };
2403
2404 let req = openshell_core::proto::GetDraftPolicyRequest {
2405 name: sandbox_name,
2406 status_filter: String::new(),
2407 };
2408
2409 match tokio::time::timeout(Duration::from_secs(5), app.client.get_draft_policy(req)).await {
2410 Ok(Ok(resp)) => {
2411 let inner = resp.into_inner();
2412 app.draft_chunks = inner.chunks;
2413 app.draft_version = inner.draft_version;
2414 if app.draft_selected >= app.draft_chunks.len() && !app.draft_chunks.is_empty() {
2415 app.draft_selected = app.draft_chunks.len() - 1;
2416 }
2417 }
2418 Ok(Err(e)) => {
2419 tracing::debug!("draft chunks refresh: {}", e.message());
2420 }
2421 Err(_) => {
2422 tracing::debug!("draft chunks refresh timed out");
2423 }
2424 }
2425}
2426
2427/// Fetch the count of pending draft recommendations for every sandbox.
2428///

Callers 1

runFunction · 0.85

Calls 4

selected_sandbox_nameMethod · 0.80
lenMethod · 0.80
get_draft_policyMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected