From 3202c3806149678b961405e76d3280de835c52ab Mon Sep 17 00:00:00 2001 From: BluJ Date: Wed, 12 Jul 2023 14:01:56 -0600 Subject: [PATCH] chore: Remove some of the things that are missing --- backend/src/backup/restore.rs | 3 --- backend/src/install/mod.rs | 29 ----------------------------- backend/src/manager/mod.rs | 1 - backend/src/procedure/docker.rs | 10 ---------- libs/js_engine/src/lib.rs | 2 +- 5 files changed, 1 insertion(+), 44 deletions(-) diff --git a/backend/src/backup/restore.rs b/backend/src/backup/restore.rs index 56b892e06..4e9d8247d 100644 --- a/backend/src/backup/restore.rs +++ b/backend/src/backup/restore.rs @@ -443,11 +443,8 @@ async fn restore_package<'a>( Ok(( progress.clone(), async move { - tracing::error!("BLUJ downloading {id}"); download_install_s9pk(&ctx, &manifest, None, progress, file, None).await?; - tracing::error!("BLUJ downlowded {id}"); guard.unmount().await?; - tracing::error!("BLUJ unmounted {id}"); Ok(()) } diff --git a/backend/src/install/mod.rs b/backend/src/install/mod.rs index 2649b7f1b..81794ddf2 100644 --- a/backend/src/install/mod.rs +++ b/backend/src/install/mod.rs @@ -1167,7 +1167,6 @@ pub async fn install_s9pk( }) .collect(), ); - tracing::error!("BLUJ 1"); let current_dependents = { let mut deps = BTreeMap::new(); for package in crate::db::DatabaseModel::new() @@ -1215,14 +1214,12 @@ pub async fn install_s9pk( } CurrentDependents(deps) }; - tracing::error!("BLUJ 2"); let mut pde = model .clone() .expect(&mut tx) .await? .get_mut(&mut tx) .await?; - tracing::error!("BLUJ 3"); let installed = InstalledPackageDataEntry { status: Status { configured: manifest.config.is_none(), @@ -1249,7 +1246,6 @@ pub async fn install_s9pk( current_dependencies: current_dependencies.clone(), interface_addresses, }; - tracing::error!("BLUJ 4"); let prev = std::mem::replace( &mut *pde, PackageDataEntry::Installed { @@ -1258,9 +1254,7 @@ pub async fn install_s9pk( static_files, }, ); - tracing::error!("BLUJ 5"); pde.save(&mut tx).await?; - tracing::error!("BLUJ 6"); let receipts = InstallS9Receipts::new(&mut tx).await?; // UpdateDependencyReceipts let mut dep_errs = model @@ -1273,7 +1267,6 @@ pub async fn install_s9pk( .dependency_errors() .get_mut(&mut tx) .await?; - tracing::error!("BLUJ 7"); *dep_errs = DependencyErrors::init( ctx, &mut tx, @@ -1282,9 +1275,7 @@ pub async fn install_s9pk( &receipts.config.try_heal_receipts, ) .await?; - tracing::error!("BLUJ 8"); dep_errs.save(&mut tx).await?; - tracing::error!("BLUJ 9"); if let PackageDataEntry::Updating { installed: prev, .. @@ -1320,7 +1311,6 @@ pub async fn install_s9pk( migration.or(prev_migration) }; - tracing::error!("BLUJ 9.1"); remove_from_current_dependents_lists( &mut tx, pkg_id, @@ -1328,14 +1318,12 @@ pub async fn install_s9pk( &receipts.config.current_dependents, ) .await?; // remove previous - tracing::error!("BLUJ 9.2"); let configured = if let Some(f) = viable_migration { f.await?.configured && prev_is_configured } else { false }; - tracing::error!("BLUJ 9.3"); if configured && manifest.config.is_some() { let breakages = BTreeMap::new(); let overrides = Default::default(); @@ -1348,7 +1336,6 @@ pub async fn install_s9pk( overrides, }; crate::config::configure(&ctx, pkg_id, configure_context).await?; - tracing::error!("BLUJ 9.4"); } else { add_dependent_to_current_dependents_lists( &mut tx, @@ -1357,7 +1344,6 @@ pub async fn install_s9pk( &receipts.config.current_dependents, ) .await?; // add new - tracing::error!("BLUJ 9.5"); } if configured || manifest.config.is_none() { let mut main_status = crate::db::DatabaseModel::new() @@ -1372,10 +1358,8 @@ pub async fn install_s9pk( .main() .get_mut(&mut tx) .await?; - tracing::error!("BLUJ 9.6"); *main_status = prev.status.main; main_status.save(&mut tx).await?; - tracing::error!("BLUJ 9.7"); } update_dependency_errors_of_dependents( ctx, @@ -1389,13 +1373,10 @@ pub async fn install_s9pk( &receipts.config.update_dependency_receipts, ) .await?; - tracing::error!("BLUJ 9.8"); if &prev.manifest.version != version { cleanup(ctx, &prev.manifest.id, &prev.manifest.version).await?; } - tracing::error!("BLUJ 9.9"); } else if let PackageDataEntry::Restoring { .. } = prev { - tracing::error!("BLUJ 9.10"); manifest .backup .restore( @@ -1407,7 +1388,6 @@ pub async fn install_s9pk( &manifest.volumes, ) .await?; - tracing::error!("BLUJ 9.11"); add_dependent_to_current_dependents_lists( &mut tx, pkg_id, @@ -1415,7 +1395,6 @@ pub async fn install_s9pk( &receipts.config.current_dependents, ) .await?; - tracing::error!("BLUJ 9.12"); update_dependency_errors_of_dependents( ctx, &mut tx, @@ -1424,9 +1403,7 @@ pub async fn install_s9pk( &receipts.config.update_dependency_receipts, ) .await?; - tracing::error!("BLUJ 9.13"); } else { - tracing::error!("BLUJ 9.14"); add_dependent_to_current_dependents_lists( &mut tx, pkg_id, @@ -1434,7 +1411,6 @@ pub async fn install_s9pk( &receipts.config.current_dependents, ) .await?; - tracing::error!("BLUJ 9.15"); update_dependency_errors_of_dependents( ctx, &mut tx, @@ -1443,20 +1419,15 @@ pub async fn install_s9pk( &receipts.config.update_dependency_receipts, ) .await?; - tracing::error!("BLUJ 9.16"); } - tracing::error!("BLUJ 10"); if let Some(installed) = pde.installed() { reconfigure_dependents_with_live_pointers(ctx, &mut tx, &receipts.config, installed) .await?; } - tracing::error!("BLUJ 11"); sql_tx.commit().await?; - tracing::error!("BLUJ 12"); tx.commit().await?; - tracing::error!("BLUJ 13"); tracing::info!("Install {}@{}: Complete", pkg_id, version); diff --git a/backend/src/manager/mod.rs b/backend/src/manager/mod.rs index b459556aa..1eef05d2e 100644 --- a/backend/src/manager/mod.rs +++ b/backend/src/manager/mod.rs @@ -267,7 +267,6 @@ impl Manager { let _ = manage_container .set_override(Some(get_status(&mut tx, &seed.manifest).await.backing_up())); manage_container.wait_for_desired(StartStop::Stop).await; - let backup_guard = backup_guard.lock().await; let guard = backup_guard.mount_package_backup(&seed.manifest.id).await?; diff --git a/backend/src/procedure/docker.rs b/backend/src/procedure/docker.rs index 5cb1ad046..59fe84399 100644 --- a/backend/src/procedure/docker.rs +++ b/backend/src/procedure/docker.rs @@ -228,12 +228,10 @@ impl DockerProcedure { input: Option, timeout: Option, ) -> Result, Error> { - tracing::error!("BLUJ Backup 1"); let name = name.docker_name(); let name: Option<&str> = name.as_ref().map(|x| &**x); let mut cmd = tokio::process::Command::new("docker"); let container_name = Self::container_name(pkg_id, name); - tracing::error!("BLUJ Backup 2"); cmd.arg("run") .arg("--rm") .arg("--network=start9") @@ -243,7 +241,6 @@ impl DockerProcedure { .arg(format!("--hostname={}", &container_name)) .arg("--no-healthcheck") .kill_on_drop(true); - tracing::error!("BLUJ Backup 3"); match ctx .docker .remove_container( @@ -263,9 +260,7 @@ impl DockerProcedure { }) => Ok(()), Err(e) => Err(e), }?; - tracing::error!("BLUJ Backup 4"); cmd.args(self.docker_args(ctx, pkg_id, pkg_version, volumes).await?); - tracing::error!("BLUJ Backup 5"); let input_buf = if let (Some(input), Some(format)) = (&input, &self.io_format) { cmd.stdin(std::process::Stdio::piped()); Some(format.to_vec(input)?) @@ -281,9 +276,7 @@ impl DockerProcedure { .collect::>() .join(" ") ); - tracing::error!("BLUJ Backup 6"); let mut handle = cmd.spawn().with_kind(crate::ErrorKind::Docker)?; - tracing::error!("BLUJ Backup 7"); let id = handle.id(); let timeout_fut = if let Some(timeout) = timeout { EitherFuture::Right(async move { @@ -296,15 +289,12 @@ impl DockerProcedure { }; if let (Some(input), Some(mut stdin)) = (&input_buf, handle.stdin.take()) { use tokio::io::AsyncWriteExt; - tracing::error!("BLUJ Backup 8"); stdin .write_all(input) .await .with_kind(crate::ErrorKind::Docker)?; stdin.flush().await?; - tracing::error!("BLUJ Backup 9"); stdin.shutdown().await?; - tracing::error!("BLUJ Backup 10"); drop(stdin); } enum Race { diff --git a/libs/js_engine/src/lib.rs b/libs/js_engine/src/lib.rs index c06b4cf4b..a89a74458 100644 --- a/libs/js_engine/src/lib.rs +++ b/libs/js_engine/src/lib.rs @@ -271,7 +271,7 @@ impl JsExecutionEnvironment { } }; let safer_handle = spawn_local(|| self.execute(procedure_name, input, variable_args)).await; - let output = safer_handle.await.unwrap()?; + let output = dbg!(safer_handle.await).unwrap()?; match serde_json::from_value(output.clone()) { Ok(x) => Ok(x), Err(err) => {