MCPcopy Create free account
hub / github.com/GCWing/BitFun / clear_active_workspace_context

Function clear_active_workspace_context

src/apps/desktop/src/api/commands.rs:848–929  ·  view source on GitHub ↗
(
    state: &State<'_, AppState>,
    app: &AppHandle,
    startup_trace: Option<&DesktopStartupTrace>,
)

Source from the content-addressed store, hash-verified

846}
847
848async fn clear_active_workspace_context(
849 state: &State<'_, AppState>,
850 app: &AppHandle,
851 startup_trace: Option<&DesktopStartupTrace>,
852) {
853 #[cfg(not(target_os = "macos"))]
854 let _ = app;
855
856 let step_started = Instant::now();
857 let previous_workspace_path = state.workspace_path.read().await.clone();
858 *state.workspace_path.write().await = None;
859 if let Some(trace) = startup_trace {
860 trace.record_elapsed_step(
861 "tauri_command",
862 "initialize_global_state.clear_active_workspace_path",
863 step_started,
864 );
865 }
866
867 if let Some(previous_workspace_path) = previous_workspace_path {
868 let step_started = Instant::now();
869 let root_str = previous_workspace_path.to_string_lossy().to_string();
870 if !is_remote_path(root_str.trim()).await {
871 state
872 .workspace_search_service
873 .schedule_repo_release(previous_workspace_path);
874 }
875 if let Some(trace) = startup_trace {
876 trace.record_elapsed_step(
877 "tauri_command",
878 "initialize_global_state.release_previous_workspace_search",
879 step_started,
880 );
881 }
882 }
883
884 if let Some(ref pool) = state.js_worker_pool {
885 let step_started = Instant::now();
886 pool.stop_all().await;
887 if let Some(trace) = startup_trace {
888 trace.record_elapsed_step(
889 "tauri_command",
890 "initialize_global_state.stop_js_worker_pool",
891 step_started,
892 );
893 }
894 }
895
896 let step_started = Instant::now();
897 state.agent_registry.clear_custom_subagents();
898 if let Some(trace) = startup_trace {
899 trace.record_elapsed_step(
900 "tauri_command",
901 "initialize_global_state.clear_custom_subagents",
902 step_started,
903 );
904 }
905

Callers 5

close_workspaceFunction · 0.85

Calls 10

is_remote_pathFunction · 0.85
record_elapsed_stepMethod · 0.80
trimMethod · 0.80
cloneMethod · 0.45
readMethod · 0.45
writeMethod · 0.45
schedule_repo_releaseMethod · 0.45
stop_allMethod · 0.45

Tested by

no test coverage detected