Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
fix(router): src file is removed multiple time
Browse files Browse the repository at this point in the history
  • Loading branch information
d33d33 committed Jul 17, 2018
1 parent d1e4dc0 commit f3e149b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/router/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ pub fn route_thread(
loop {
match todo.lock().unwrap().pop_front() {
Some(path) => {
debug!("Processing: {:?}", path);
if let Err(err) = route(&path, &config, id) {
warn!("{}", err);
warn!("Fail to process:{:?} - {}", path, err);
}
}
None => {
Expand Down Expand Up @@ -99,11 +100,11 @@ fn route(path: &PathBuf, config: &RouterConfig, id: u64) -> Result<(), Box<Error
let dest_file = dir.join(format!("{}-{}-{}.metrics", sink.name, id, run_id));
debug!("rename {:?} to {:?}", sink_file_name, dest_file);
fs::rename(sink_file_name, dest_file)?;

// Delete source file
debug!("delete {}", format!("{:?}", path));
fs::remove_file(&path)?;
}

// Delete source file
debug!("delete {}", format!("{:?}", path));
fs::remove_file(&path)?;

Ok(())
}

0 comments on commit f3e149b

Please sign in to comment.