remote_server: Cleanup old server binaries on wsl (#47839)
Closes https://github.com/zed-industries/zed/issues/44736 Release Notes: - Fixed remote server binaries accumulating on wsl over time
This commit is contained in:
1 parent
6cf6032f90
commit
19aa418dea
3 files changed
+17
-4
No files matched your search
@@ -36,6 +36,7 @@ pub fn remote_server_dir_relative() -> &'static RelPath {
|
||||
*CACHED
|
||||
}
|
||||
|
||||
// Remove this once 223 goes stable
|
||||
/// Returns the relative path to the zed_wsl_server directory on the wsl host.
|
||||
pub fn remote_wsl_server_dir_relative() -> &'static RelPath {
|
||||
static CACHED: LazyLock<&'static RelPath> =
|
||||
|
||||
@@ -176,7 +176,7 @@ impl WslRemoteConnection {
|
||||
);
|
||||
|
||||
let dst_path =
|
||||
paths::remote_wsl_server_dir_relative().join(RelPath::unix(&binary_name).unwrap());
|
||||
paths::remote_server_dir_relative().join(RelPath::unix(&binary_name).unwrap());
|
||||
|
||||
if let Some(parent) = dst_path.parent() {
|
||||
let parent = parent.display(PathStyle::Posix);
|
||||
@@ -200,7 +200,7 @@ impl WslRemoteConnection {
|
||||
)
|
||||
.await?
|
||||
{
|
||||
let tmp_path = paths::remote_wsl_server_dir_relative().join(
|
||||
let tmp_path = paths::remote_server_dir_relative().join(
|
||||
&RelPath::unix(&format!(
|
||||
"download-{}-{}",
|
||||
std::process::id(),
|
||||
|
||||
@@ -575,8 +575,11 @@ pub fn execute_run(
|
||||
|
||||
handle_crash_files_requests(&project, &session);
|
||||
|
||||
cx.background_spawn(async move { cleanup_old_binaries() })
|
||||
.detach();
|
||||
cx.background_spawn(async move {
|
||||
cleanup_old_binaries_wsl();
|
||||
cleanup_old_binaries()
|
||||
})
|
||||
.detach();
|
||||
|
||||
mem::forget(project);
|
||||
};
|
||||
@@ -1174,6 +1177,15 @@ fn cleanup_old_binaries() -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Remove this once 223 goes stable, we only have this to clean up old binaries on WSL
|
||||
// we no longer download them into this folder, we use the same folder as other remote servers
|
||||
fn cleanup_old_binaries_wsl() {
|
||||
let server_dir = paths::remote_wsl_server_dir_relative();
|
||||
if let Ok(()) = std::fs::remove_dir_all(server_dir.as_std_path()) {
|
||||
log::info!("removing old wsl remote server folder: {:?}", server_dir);
|
||||
}
|
||||
}
|
||||
|
||||
fn is_new_version(version: &str) -> bool {
|
||||
semver::Version::from_str(version)
|
||||
.ok()
|
||||
|
||||
Reference in new issue
Block a user