From de434bb437f64b0ed262a5bb089c6a82a18312eb Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Wed, 1 May 2024 08:53:53 +0100 Subject: [PATCH] node: simplify upload-pack reader joining The `join` method is equivalent to the custom loop that was written for joining the `reader` thread in upload-pack. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-node/src/worker/upload_pack.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/radicle-node/src/worker/upload_pack.rs b/radicle-node/src/worker/upload_pack.rs index d448bd8c..4d60e43c 100644 --- a/radicle-node/src/worker/upload_pack.rs +++ b/radicle-node/src/worker/upload_pack.rs @@ -124,14 +124,10 @@ where // N.b. we only care if the `reader` is finished. We then kill // the child which will end the thread for the sender. - loop { - if reader.is_finished() { - child.kill()?; - break; - } else { - std::thread::sleep(std::time::Duration::from_millis(100)); - } + if let Err(e) = reader.join() { + log::warn!(target: "worker", "Upload pack thread panicked: {e:?}"); } + child.kill()?; Ok::<_, io::Error>(()) })?;