mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
Refactor and enhance debugging in walk.rs and scan.rs
- Removed unused commented-out code in `walk.rs` for improved readability. - Added more `tracing::debug` logs for clearer traceability during file scanning and rule processing. - Improved condition handling and formatting consistency in `scan.rs`. - Simplified error management and removed redundant comments in database-related functions.
This commit is contained in:
parent
80c0bc9845
commit
8bc16ac940
2 changed files with 15 additions and 39 deletions
29
src/walk.rs
29
src/walk.rs
|
|
@ -72,38 +72,13 @@ pub fn spawn_senders(
|
|||
.threads(worker_thrs)
|
||||
.overrides(overrides)
|
||||
.build_parallel();
|
||||
|
||||
|
||||
/*
|
||||
walker.run(move || {
|
||||
let tx = tx.clone();
|
||||
let mut batch = Vec::<PathBuf>::with_capacity(256);
|
||||
|
||||
Box::new(move |entry| {
|
||||
tracing::debug!("walking: {:?}", entry);
|
||||
|
||||
let mut b = Batcher { tx: tx.clone(), batch: Vec::with_capacity(BATCH_SIZE) };
|
||||
match entry {
|
||||
Ok(e) if e.file_type().is_some_and(|ft| ft.is_file()) => {
|
||||
b.push(e.into_path());
|
||||
tracing::debug!("scanning file: {:?}", b);
|
||||
if batch.len() == BATCH_SIZE {
|
||||
let _ = tx.send(std::mem::take(&mut batch));
|
||||
}
|
||||
}
|
||||
Err(err) => tracing::error!("walk error: {err}"),
|
||||
_ => {}
|
||||
}
|
||||
WalkState::Continue
|
||||
})
|
||||
});
|
||||
*/
|
||||
|
||||
walker.run(move || {
|
||||
let mut batcher = Batcher {
|
||||
tx: tx.clone(),
|
||||
batch: Vec::with_capacity(BATCH_SIZE),
|
||||
};
|
||||
|
||||
|
||||
Box::new(move |entry| {
|
||||
tracing::debug!("walking: {:?}", entry);
|
||||
let e = match entry {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue