proxmox-rrd: log all errors from apply_and_commit_journal_thread (but only once)
This commit is contained in:
parent
ac2ca6c341
commit
c17fbbbc07
@ -154,19 +154,17 @@ impl RRDCache {
|
|||||||
|
|
||||||
let mut state_guard = self.state.write().unwrap();
|
let mut state_guard = self.state.write().unwrap();
|
||||||
let journal_applied = state_guard.journal_applied;
|
let journal_applied = state_guard.journal_applied;
|
||||||
let now = proxmox_time::epoch_f64();
|
|
||||||
let wants_commit = (now - state_guard.last_journal_flush) > self.config.apply_interval;
|
|
||||||
|
|
||||||
if journal_applied && !wants_commit { return Ok(journal_applied); }
|
|
||||||
|
|
||||||
if let Some(ref recv) = state_guard.apply_thread_result {
|
if let Some(ref recv) = state_guard.apply_thread_result {
|
||||||
match recv.try_recv() {
|
match recv.try_recv() {
|
||||||
Ok(Ok(())) => {
|
Ok(Ok(())) => {
|
||||||
// finished without errors, OK
|
// finished without errors, OK
|
||||||
|
state_guard.apply_thread_result = None;
|
||||||
}
|
}
|
||||||
Ok(Err(err)) => {
|
Ok(Err(err)) => {
|
||||||
// finished with errors, log them
|
// finished with errors, log them
|
||||||
log::error!("{}", err);
|
log::error!("{}", err);
|
||||||
|
state_guard.apply_thread_result = None;
|
||||||
}
|
}
|
||||||
Err(TryRecvError::Empty) => {
|
Err(TryRecvError::Empty) => {
|
||||||
// still running
|
// still running
|
||||||
@ -175,10 +173,16 @@ impl RRDCache {
|
|||||||
Err(TryRecvError::Disconnected) => {
|
Err(TryRecvError::Disconnected) => {
|
||||||
// crashed, start again
|
// crashed, start again
|
||||||
log::error!("apply journal thread crashed - try again");
|
log::error!("apply journal thread crashed - try again");
|
||||||
|
state_guard.apply_thread_result = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let now = proxmox_time::epoch_f64();
|
||||||
|
let wants_commit = (now - state_guard.last_journal_flush) > self.config.apply_interval;
|
||||||
|
|
||||||
|
if journal_applied && !wants_commit { return Ok(journal_applied); }
|
||||||
|
|
||||||
state_guard.last_journal_flush = proxmox_time::epoch_f64();
|
state_guard.last_journal_flush = proxmox_time::epoch_f64();
|
||||||
|
|
||||||
let (sender, receiver) = bounded(1);
|
let (sender, receiver) = bounded(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user