Skip to content

Commit

Permalink
Comment out a harmless error message emission
Browse files Browse the repository at this point in the history
  • Loading branch information
CaspianA1 committed Sep 26, 2024
1 parent 7e3d904 commit 742bf65
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utility_types/continually_updated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ impl<T: Updatable + 'static> ContinuallyUpdated<T> {
thread::Builder::new().name(name.to_string()).stack_size(STACK_SIZE).spawn(move || {
loop {
fn handle_channel_error<Error: std::fmt::Display>(err: Error, name: &str, transfer_description: &str) {
log::warn!("Problem from {name} with {transfer_description} main thread (probably harmless, at program shutdown): {err}");
log::warn!("Problem from '{name}' with {transfer_description} main thread (probably harmless, at program shutdown): '{err}'");
}

/* `recv` will block until it receives the parameter! The parameters will
only be passed once the data has been received on the main thread. */
let param = match param_receiver.recv() {
Ok(inner_param) => inner_param,

Err(err) => {
handle_channel_error(err, name, "receiving parameter from");
Err(_err) => {
// This happens almost every time, so just silencing this (it's harmless)
// handle_channel_error(_err, name, "receiving parameter from");
return;
}
};
Expand All @@ -70,7 +71,7 @@ impl<T: Updatable + 'static> ContinuallyUpdated<T> {
};

if let Err(err) = continually_updated.run_new_update_iteration(initial_param) {
panic!("Could not pass an initial param to the continual updater: {err}");
panic!("Could not pass an initial param to the continual updater: '{err}'");
}

continually_updated
Expand Down Expand Up @@ -100,7 +101,7 @@ impl<T: Updatable + 'static> ContinuallyUpdated<T> {
}

if let Some(err) = error {
log::error!("Updating the '{}' data on this iteration failed. Error: '{err}'.", self.name);
log::error!("Updating the '{}' data on this iteration failed. Error: '{err}'", self.name);
self.run_new_update_iteration(param)?;
return Ok(false);
}
Expand Down

0 comments on commit 742bf65

Please sign in to comment.