Skip to content

Commit 061a6bc

Browse files
committed
File is now fixed.
1 parent 23e86a5 commit 061a6bc

2 files changed

Lines changed: 5 additions & 48 deletions

File tree

src/main.rs

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::io::{BufWriter, Write};
33
use std::path::{Path, PathBuf};
44
use std::sync::Arc;
55
use std::sync::atomic::{AtomicUsize, Ordering};
6-
use std::time::Duration;
76

87
use ahash::{AHashMap as HashMap, AHashSet as HashSet};
98
use anyhow::{Context, Result};
@@ -293,55 +292,11 @@ fn main() -> Result<()> {
293292
pb.set_message("Scanning files...");
294293
}
295294

296-
// Track currently processing files to identify stuck ones
297-
let processing_files = Arc::new(std::sync::Mutex::new(HashMap::<std::thread::ThreadId, PathBuf>::new()));
298-
let processing_files_clone = processing_files.clone();
299-
300-
// Spawn a monitor thread that reports stuck files
301-
std::thread::spawn(move || {
302-
loop {
303-
std::thread::sleep(Duration::from_secs(30));
304-
let files = processing_files_clone.lock().unwrap();
305-
if !files.is_empty() {
306-
eprintln!("\n=== FILES CURRENTLY BEING PROCESSED (>30s) ===");
307-
for (thread_id, path) in files.iter() {
308-
eprintln!(" Thread {:?}: {}", thread_id, path.display());
309-
}
310-
eprintln!("===============================================\n");
311-
}
312-
}
313-
});
314-
315295
// Process files in parallel with rayon
316296
files_to_scan.into_par_iter().for_each(|path| {
317-
let thread_id = std::thread::current().id();
318-
319-
// Register this file as being processed
320-
{
321-
let mut files = processing_files.lock().unwrap();
322-
files.insert(thread_id, path.clone());
323-
}
324-
325297
// Process the file
326-
let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
327-
process_file(&path, &patterns, &tx)
328-
}));
329-
330-
// Unregister this file
331-
{
332-
let mut files = processing_files.lock().unwrap();
333-
files.remove(&thread_id);
334-
}
335-
336-
// Handle result
337-
match result {
338-
Ok(Ok(())) => {}
339-
Ok(Err(err)) => {
340-
eprintln!("Error processing {}: {err:#}", path.display());
341-
}
342-
Err(_) => {
343-
eprintln!("PANIC while processing {}", path.display());
344-
}
298+
if let Err(err) = process_file(&path, &patterns, &tx) {
299+
eprintln!("Error processing {}: {err:#}", path.display());
345300
}
346301

347302
scanned_count.fetch_add(1, Ordering::Relaxed);

src/scan.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ pub fn parse(lang: Language, content: &str) -> Result<Tree> {
136136
};
137137
parser.set_language(&ts_lang).context("set language")?;
138138

139-
// Set a timeout to prevent the parser from hanging on malformed code
139+
// Allow deprecated method for now - the new API is more complex
140+
// and the current method works fine for our needs
141+
#[allow(deprecated)]
140142
parser.set_timeout_micros(5_000_000); // 5 second timeout
141143

142144
parser.parse(content, None).context("parse")

0 commit comments

Comments
 (0)