Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions crates/codegraph/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,6 @@ async fn cmd_serve(
} else {
allowed_hosts.extend(allow_host);
}
let use_root = !is_fs_root(root);
if use_root && is_initialized(root) {
watcher::spawn(root.to_path_buf(), storage_dsn(root));
}
return codegraph_mcp::serve_http(
format,
mermaid,
Expand All @@ -630,10 +626,7 @@ async fn cmd_serve(
// session and let the agent bind the project path through the tool.
let use_root = !is_fs_root(root);
let initialized = use_root && is_initialized(root);
let dsn = if initialized { storage_dsn(root) } else { None };
if initialized {
watcher::spawn(root.to_path_buf(), dsn.clone());
}
let _dsn = if initialized { storage_dsn(root) } else { None };
let server = if use_root {
CodegraphServer::with_root_and_format(root.to_path_buf(), format, mermaid).await?
} else {
Expand Down
8 changes: 0 additions & 8 deletions crates/codegraph/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ use std::time::Duration;
/// Spawn a debounced watcher that full re-indexes the workspace on file changes.
/// Runs on a background tokio task; cancellation when the runtime drops.
/// `dsn = None` (in-memory backend) → không có file ngoài để theo dõi, bỏ qua.
pub fn spawn(root: Utf8PathBuf, dsn: Option<String>) {
let Some(dsn) = dsn else { return };
tokio::task::spawn_blocking(move || {
if let Err(e) = run(root, dsn) {
tracing::error!("watcher error: {e}");
}
});
}

fn run(root: Utf8PathBuf, dsn: String) -> Result<()> {
let (tx, rx) = std::sync::mpsc::channel::<Vec<DebouncedEvent>>();
Expand Down
Loading