From 508490161356834f29c2f0b32ccadfbf78457222 Mon Sep 17 00:00:00 2001 From: d33d33 Date: Mon, 7 Aug 2017 12:47:31 +0200 Subject: [PATCH] fix: sink files are not processed In some condition sinks files override a previous one --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/router.rs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42170d8..ea56e7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [root] name = "beamium" -version = "1.6.4" +version = "1.6.5" dependencies = [ "cast 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.24.2 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 621dfc7..351c1ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "beamium" -version = "1.6.4" +version = "1.6.5" authors = [ "d33d33 " ] build = "build.rs" diff --git a/src/router.rs b/src/router.rs index 079436d..42f01b3 100644 --- a/src/router.rs +++ b/src/router.rs @@ -68,7 +68,8 @@ fn route(sinks: &Vec, -> Result> { let mut proc_size = 0; let mut batch_count = 0; - let start = time::now_utc().to_timespec().sec; + let start = time::now_utc().to_timespec(); + let run_id = format!("{}#{}", start.sec, start.nsec); loop { if sigint.load(Ordering::Relaxed) { @@ -188,7 +189,7 @@ fn route(sinks: &Vec, // Rotate for sink in sinks { - let dest_file = dir.join(format!("{}-{}-{}.metrics", sink.name, start, batch_count)); + let dest_file = dir.join(format!("{}-{}-{}.metrics", sink.name, run_id, batch_count)); debug!("rotate tmp sink file to {}", format!("{:?}", dest_file)); try!(fs::rename(dir.join(format!("{}.tmp", sink.name)), dest_file)); }