Skip to content

Commit

Permalink
avoid thread blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi0804 committed Feb 17, 2025
1 parent 13b8530 commit 4ae42b9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/maker/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ fn network_bootstrap(maker: Arc<Maker>) -> Result<Option<Child>, MakerError> {
}
// Reset counter when success
i = 0;
} else {
// Do not block the process thread
status_sender
.send(Err(MakerError::General(
"Maximum retry limit reached, avoiding thread blocking",
)))
.unwrap();
}
i += 1;
thread::sleep(HEART_BEAT_INTERVAL);
Expand All @@ -256,7 +263,7 @@ fn network_bootstrap(maker: Arc<Maker>) -> Result<Option<Child>, MakerError> {

match status_recv.recv() {
Ok(status) => {
if let Err(e) = status {
if let Err(e @ MakerError::UnexpectedMessage { .. }) = status {
log::error!("{:?}", e);
return Err(e);
}
Expand Down

0 comments on commit 4ae42b9

Please sign in to comment.