From 154a3915a68f2a16f71ca95b6924523dba610479 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 6 Jan 2025 12:01:16 -0500 Subject: [PATCH] zed: Add timeouts for feature flag resolution in workspace panel initialization (#22715) This PR adds timeouts when resolving feature flags during workspace panel initialization so that we don't block indefinitely if Zed is not connected to the internet. Right now we wait for 5 seconds, but this value was chosen arbitrarily. Release Notes: - N/A --- crates/zed/src/zed.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index f32441e840..f005768600 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -20,6 +20,7 @@ use command_palette_hooks::CommandPaletteFilter; use editor::ProposedChangesEditorToolbar; use editor::{scroll::Autoscroll, Editor, MultiBuffer}; use feature_flags::FeatureFlagAppExt; +use futures::FutureExt; use futures::{channel::mpsc, select_biased, StreamExt}; use gpui::{ actions, point, px, AppContext, AsyncAppContext, Context, FocusableView, MenuItem, @@ -348,7 +349,16 @@ fn initialize_panels(prompt_builder: Arc, cx: &mut ViewContext is_git_ui_enabled, + _ = timeout => false, + } + }; let git_panel = if git_ui_enabled { Some(git_ui::git_panel::GitPanel::load(workspace_handle.clone(), cx.clone()).await?) } else { @@ -363,7 +373,14 @@ fn initialize_panels(prompt_builder: Arc, cx: &mut ViewContext is_assistant2_enabled, + _ = timeout => false, + } }; let assistant2_panel = if is_assistant2_enabled { Some(assistant2::AssistantPanel::load(workspace_handle.clone(), cx.clone()).await?)