Skip to content

Commit d1d2005

Browse files
committed
makes timeout fut resolve immediately for tests
1 parent 0e82438 commit d1d2005

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

crates/chat-cli/src/cli/chat/tool_manager.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -747,20 +747,17 @@ impl ToolManager {
747747
};
748748
Box::pin(fut)
749749
},
750-
None => {
751-
let fut = async { future::pending::<()>().await };
752-
Box::pin(fut)
753-
},
750+
None => Box::pin(future::pending()),
754751
};
755-
// TODO: make this timeout configurable
756-
let timeout_fut: Pin<Box<dyn Future<Output = ()>>> = if self.is_interactive {
752+
let timeout_fut: Pin<Box<dyn Future<Output = ()>>> = if self.clients.is_empty() {
753+
// If there is no server loaded, we want to resolve immediately
754+
Box::pin(future::ready(()))
755+
} else if self.is_interactive {
757756
let init_timeout = crate::settings::settings::get_int("mcp.initTimeout")
758757
.map_or(5000_u64, |s| s.map_or(5000_u64, |n| n as u64));
759-
error!("## timeout: {init_timeout}");
760758
Box::pin(tokio::time::sleep(std::time::Duration::from_millis(init_timeout)))
761759
} else {
762-
let fut = async { future::pending::<()>().await };
763-
Box::pin(fut)
760+
Box::pin(future::pending())
764761
};
765762
tokio::select! {
766763
_ = display_fut => {},

0 commit comments

Comments
 (0)