mirror of
https://github.com/msfjarvis/healthchecks-rs.git
synced 2024-06-03 04:18:58 +05:30
fix(monitor): only retain the last execution log
This commit is contained in:
parent
9488530b05
commit
0f40fb02ba
|
@ -5,15 +5,14 @@ pub(crate) fn run_with_retry(
|
||||||
retries: u8,
|
retries: u8,
|
||||||
save_logs: bool,
|
save_logs: bool,
|
||||||
) -> Result<(), Option<String>> {
|
) -> Result<(), Option<String>> {
|
||||||
let mut logs = String::new();
|
let mut logs: Option<String> = None;
|
||||||
for _ in 0..retries {
|
for _ in 0..retries {
|
||||||
match run_command(command, save_logs) {
|
match run_command(command, save_logs) {
|
||||||
Ok(_) => return Ok(()),
|
Ok(_) => return Ok(()),
|
||||||
Err(Some(e)) => logs.push_str(&e),
|
Err(e) => logs = e,
|
||||||
Err(_) => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(Some(logs))
|
Err(logs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_command(command: &str, save_logs: bool) -> Result<(), Option<String>> {
|
fn run_command(command: &str, save_logs: bool) -> Result<(), Option<String>> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user