Prevent hot patch from leaving devserver in BuildError state (#4784)
Scenario: without this patch, if you fail a build, fix the code, let the thin build succeed, and then refresh the browser... then after reloading the browser page, it gets stuck on the "One sec" loader because the devserver status never clears the earlier BuildError. - mark build status ready after sending hot patch messages so refreshes succeed - reuse the same helper from reload command to avoid stale loading screens - add set_ready() helper to avoid duplicate status broadcasts
This commit is contained in:
1 parent
bc3b99b7fc
commit
a3e40a5ea2
1 file changed
+12
-2
@@ -316,6 +316,7 @@ impl WebServer {
|
||||
for_build_id: Some(build.0 as _),
|
||||
});
|
||||
self.send_devserver_message_to_all(msg).await;
|
||||
self.set_ready().await;
|
||||
}
|
||||
|
||||
/// Tells all clients that a hot patch has started.
|
||||
@@ -338,8 +339,7 @@ impl WebServer {
|
||||
|
||||
/// Tells all clients to reload if possible for new changes.
|
||||
pub(crate) async fn send_reload_command(&mut self) {
|
||||
self.build_status.set(Status::Ready);
|
||||
self.send_build_status().await;
|
||||
self.set_ready().await;
|
||||
self.send_devserver_message_to_all(DevserverMsg::FullReloadCommand)
|
||||
.await;
|
||||
}
|
||||
@@ -360,6 +360,16 @@ impl WebServer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Mark the devserver status as ready and notify listeners.
|
||||
async fn set_ready(&mut self) {
|
||||
if matches!(self.build_status.get(), Status::Ready) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.build_status.set(Status::Ready);
|
||||
self.send_build_status().await;
|
||||
}
|
||||
|
||||
/// Get the address the devserver should run on
|
||||
pub fn devserver_address(&self) -> SocketAddr {
|
||||
SocketAddr::new(self.devserver_exposed_ip, self.devserver_port)
|
||||
|
||||
Reference in new issue
Block a user