forge
Explore
Log in

Don't you dare go Hollow

A required update no longer restarts the builder's client mid Build & publish: it installs right away, keeps the builder page up while the build runs, and restarts once the build thread ends

Browse files at this commit

d911f94c8f4f6c2d6ac439a11f2764c4885b61eaAhmet Kaan GümüşParent: b16b8f6
  • fix
    • a required update no longer restarts the builder's client mid Build & publish: it installs right away, keeps the builder page up while the build runs, and restarts once the build thread ends
Show full message
🐛 fix: a required update no longer restarts the builder's client mid Build & publish: it installs right away, keeps the builder page up while the build runs, and restarts once the build thread ends
crates/client/src/gui.rsmodified+1 -1
@@ -1493,7 +1493,7 @@ impl Render for Yumush {
1493 self.schedule_pump(window, cx);1493 self.schedule_pump(window, cx);
1494 let palette = palette(cx);1494 let palette = palette(cx);
1495 let route = self.current_route;1495 let route = self.current_route;
1496- let required = self.update.required();1496+ let required = self.update.required() && !crate::release::running();
1497 let page = match route {1497 let page = match route {
1498 _ if required => self.update_required(palette).into_any_element(),1498 _ if required => self.update_required(palette).into_any_element(),
1499 Route::Login | Route::Register => self.auth_page(route, cx).into_any_element(),1499 Route::Login | Route::Register => self.auth_page(route, cx).into_any_element(),
crates/client/src/release.rsmodified+26 -1
@@ -49,6 +49,27 @@ const TARGET: &str = "yumush@127.0.0.1";
49 const PORT: &str = "2222";49 const PORT: &str = "2222";
50 const EXTRACT: &str = "Remove-Item -Recurse -Force release -ErrorAction SilentlyContinue; New-Item -ItemType Directory release | Out-Null; tar -xmzf release.tgz -C release";50 const EXTRACT: &str = "Remove-Item -Recurse -Force release -ErrorAction SilentlyContinue; New-Item -ItemType Directory release | Out-Null; tar -xmzf release.tgz -C release";
51 51
52+static RUNNING: AtomicBool = AtomicBool::new(false);
53+
54+pub fn running() -> bool {
55+ RUNNING.load(Ordering::SeqCst)
56+}
57+
58+struct Running;
59+
60+impl Running {
61+ fn new() -> Self {
62+ RUNNING.store(true, Ordering::SeqCst);
63+ Self
64+ }
65+}
66+
67+impl Drop for Running {
68+ fn drop(&mut self) {
69+ RUNNING.store(false, Ordering::SeqCst);
70+ }
71+}
72+
52 pub fn is_source(path: &Path) -> bool {73 pub fn is_source(path: &Path) -> bool {
53 path.join("crates/client/Cargo.toml").is_file() && path.join(".git").exists()74 path.join("crates/client/Cargo.toml").is_file() && path.join(".git").exists()
54 }75 }
@@ -70,7 +91,11 @@ impl Build {
70 cancel: build.cancel.clone(),91 cancel: build.cancel.clone(),
71 child: build.child.clone(),92 child: build.child.clone(),
72 };93 };
73- thread::spawn(move || run(&source, &cx));94+ let running = Running::new();
95+ thread::spawn(move || {
96+ let _running = running;
97+ run(&source, &cx);
98+ });
74 (build, rx)99 (build, rx)
75 }100 }
76 101
crates/client/src/update.rsmodified+4 -0
@@ -15,6 +15,7 @@ pub const RESTART: &str = "--restart";
15 pub const TARGET: &str = env!("YUMUSH_TARGET");15 pub const TARGET: &str = env!("YUMUSH_TARGET");
16 const MARK: &str = concat!("yumush-target:", env!("YUMUSH_TARGET"), ";");16 const MARK: &str = concat!("yumush-target:", env!("YUMUSH_TARGET"), ";");
17 const CHUNK: usize = 256 << 10;17 const CHUNK: usize = 256 << 10;
18+const BUILD_WAIT: std::time::Duration = std::time::Duration::from_secs(1);
18 19
19 #[derive(Debug, Clone, Copy, PartialEq, Eq)]20 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
20 pub enum Phase {21 pub enum Phase {
@@ -260,6 +261,9 @@ pub fn install() {
260 };261 };
261 runtime.block_on(report(&server, me, progress));262 runtime.block_on(report(&server, me, progress));
262 if progress == Progress::Ready && offer.required {263 if progress == Progress::Ready && offer.required {
264+ while crate::release::running() {
265+ std::thread::sleep(BUILD_WAIT);
266+ }
263 restart();267 restart();
264 }268 }
265 });269 });