From d911f94c8f4f6c2d6ac439a11f2764c4885b61ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 1 Dec 2026 03:57:57 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20a=20required=20update=20n?= =?UTF-8?q?o=20longer=20restarts=20the=20builder's=20client=20mid=20Build?= =?UTF-8?q?=20&=20publish:=20it=20installs=20right=20away,=20keeps=20the?= =?UTF-8?q?=20builder=20page=20up=20while=20the=20build=20runs,=20and=20re?= =?UTF-8?q?starts=20once=20the=20build=20thread=20ends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/gui.rs | 2 +- crates/client/src/release.rs | 27 ++++++++++++++++++++++++++- crates/client/src/update.rs | 4 ++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/crates/client/src/gui.rs b/crates/client/src/gui.rs index fdf4ac9..a4f2c2b 100644 --- a/crates/client/src/gui.rs +++ b/crates/client/src/gui.rs @@ -1493,7 +1493,7 @@ impl Render for Yumush { self.schedule_pump(window, cx); let palette = palette(cx); let route = self.current_route; - let required = self.update.required(); + let required = self.update.required() && !crate::release::running(); let page = match route { _ if required => self.update_required(palette).into_any_element(), Route::Login | Route::Register => self.auth_page(route, cx).into_any_element(), diff --git a/crates/client/src/release.rs b/crates/client/src/release.rs index e587024..7803bfe 100644 --- a/crates/client/src/release.rs +++ b/crates/client/src/release.rs @@ -49,6 +49,27 @@ const TARGET: &str = "yumush@127.0.0.1"; const PORT: &str = "2222"; const EXTRACT: &str = "Remove-Item -Recurse -Force release -ErrorAction SilentlyContinue; New-Item -ItemType Directory release | Out-Null; tar -xmzf release.tgz -C release"; +static RUNNING: AtomicBool = AtomicBool::new(false); + +pub fn running() -> bool { + RUNNING.load(Ordering::SeqCst) +} + +struct Running; + +impl Running { + fn new() -> Self { + RUNNING.store(true, Ordering::SeqCst); + Self + } +} + +impl Drop for Running { + fn drop(&mut self) { + RUNNING.store(false, Ordering::SeqCst); + } +} + pub fn is_source(path: &Path) -> bool { path.join("crates/client/Cargo.toml").is_file() && path.join(".git").exists() } @@ -70,7 +91,11 @@ impl Build { cancel: build.cancel.clone(), child: build.child.clone(), }; - thread::spawn(move || run(&source, &cx)); + let running = Running::new(); + thread::spawn(move || { + let _running = running; + run(&source, &cx); + }); (build, rx) } diff --git a/crates/client/src/update.rs b/crates/client/src/update.rs index 37b118e..c92488c 100644 --- a/crates/client/src/update.rs +++ b/crates/client/src/update.rs @@ -15,6 +15,7 @@ pub const RESTART: &str = "--restart"; pub const TARGET: &str = env!("YUMUSH_TARGET"); const MARK: &str = concat!("yumush-target:", env!("YUMUSH_TARGET"), ";"); const CHUNK: usize = 256 << 10; +const BUILD_WAIT: std::time::Duration = std::time::Duration::from_secs(1); #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Phase { @@ -260,6 +261,9 @@ pub fn install() { }; runtime.block_on(report(&server, me, progress)); if progress == Progress::Ready && offer.required { + while crate::release::running() { + std::thread::sleep(BUILD_WAIT); + } restart(); } });