diff --git a/Cargo.lock b/Cargo.lock index bbfe99ca..9838a2fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ [root] name = "cernan" -version = "0.7.5-pre" +version = "0.7.5" dependencies = [ "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index dc965665..159b0d91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" name = "cernan" readme = "README.md" repository = "https://github.com/postmates/cernan" -version = "0.7.5-pre" +version = "0.7.5" [[bin]] name = "cernan" diff --git a/src/source/file/file_server.rs b/src/source/file/file_server.rs index f03ebacc..ddd3edb4 100644 --- a/src/source/file/file_server.rs +++ b/src/source/file/file_server.rs @@ -118,28 +118,21 @@ impl Source for FileServer { // line polling for (path, mut watcher) in fp_map.drain() { let mut lines_read: usize = 0; - loop { - match watcher.read_line(&mut buffer) { - Ok(sz) => { - if sz > 0 { - lines_read += 1; - lines.push( - metric::LogLine::new( - path.to_str().expect("not a valid path"), - &buffer, - ).overlay_tags_from_map(&self.tags), - ); - buffer.clear(); - } else { - break; - } - if lines_read > self.max_lines_read { - break; - } - } - _ => { - break; - } + while let Ok(sz) = watcher.read_line(&mut buffer) { + if sz > 0 { + lines_read += 1; + lines.push( + metric::LogLine::new( + path.to_str().expect("not a valid path"), + &buffer, + ).overlay_tags_from_map(&self.tags), + ); + buffer.clear(); + } else { + break; + } + if lines_read > self.max_lines_read { + break; } } report_full_telemetry( diff --git a/src/source/file/file_watcher.rs b/src/source/file/file_watcher.rs index 4372c49b..f688fffb 100644 --- a/src/source/file/file_watcher.rs +++ b/src/source/file/file_watcher.rs @@ -96,10 +96,8 @@ impl FileWatcher { /// up to some maximum but unspecified amount of time. `read_line` will open /// a new file handler at need, transparently to the caller. pub fn read_line(&mut self, mut buffer: &mut String) -> io::Result { - if self.reopen { - if self.file_id() != self.file_id { - self.open_at_start(); - } + if self.reopen && self.file_id() != self.file_id { + self.open_at_start(); } if let Some(ref mut reader) = self.reader { // match here on error, if metadata doesn't match up open_at_start @@ -115,11 +113,8 @@ impl FileWatcher { Ok(buffer.len()) } Err(e) => { - match e.kind() { - io::ErrorKind::NotFound => { - self.reopen = true; - } - _ => {} + if let io::ErrorKind::NotFound = e.kind() { + self.reopen = true; } Err(e) }