Skip to content

Commit

Permalink
diagnoostics: return empty response if search path dose not exist (#7541
Browse files Browse the repository at this point in the history
)

Signed-off-by: Fullstop000 <[email protected]>
  • Loading branch information
Fullstop000 committed Apr 21, 2020
1 parent b3e969f commit adf3a94
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/service/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,7 @@ mod log {
const INVALID_TIMESTAMP: i64 = -1;
const TIMESTAMP_LENGTH: usize = 30;

#[derive(Default)]
struct LogIterator {
search_files: Vec<(i64, File)>,
currrent_lines: Option<std::io::Lines<BufReader<File>>>,
Expand Down Expand Up @@ -1109,6 +1110,9 @@ mod log {
log_file: P,
mut req: SearchLogRequest,
) -> Result<impl Stream<Item = SearchLogResponse, Error = ()>, Error> {
if !log_file.as_ref().exists() {
return Ok(bacth_log_item(LogIterator::default()));
}
let begin_time = req.get_start_time();
let end_time = req.get_end_time();
let levels = req.take_levels();
Expand Down

0 comments on commit adf3a94

Please sign in to comment.