mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
agressive locking
This commit is contained in:
committed by
Aiden McClelland
parent
e3d8861199
commit
443e313566
@@ -1,3 +1,4 @@
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use rpc_toolkit::command;
|
||||
@@ -55,6 +56,10 @@ pub fn restart(#[context] ctx: DiagnosticContext) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
#[command(rename = "forget-disk", display(display_none))]
|
||||
pub fn forget_disk(#[context] ctx: DiagnosticContext) -> Result<(), Error> {
|
||||
todo!()
|
||||
pub async fn forget_disk() -> Result<(), Error> {
|
||||
let disk_guid = Path::new("/embassy-os/disk.guid");
|
||||
if tokio::fs::metadata(disk_guid).await.is_ok() {
|
||||
tokio::fs::remove_file(disk_guid).await?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -35,10 +35,10 @@ pub async fn synchronize_all(ctx: &RpcContext) -> Result<(), Error> {
|
||||
// this locks all of package data to solve a deadlock issue below. As of the writing of this comment, it
|
||||
// hangs during the `check` operation on /package-data/<id>. There is another daemon loop somewhere that
|
||||
// is likely iterating through packages in a different order.
|
||||
// crate::db::DatabaseModel::new()
|
||||
// .package_data()
|
||||
// .lock(&mut db)
|
||||
// .await;
|
||||
crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.lock(&mut db, true)
|
||||
.await;
|
||||
|
||||
// Without the above lock, the below check operation will deadlock
|
||||
let (mut status, manager) = if let Some(installed) = crate::db::DatabaseModel::new()
|
||||
|
||||
Reference in New Issue
Block a user