mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
agressive locking
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use rpc_toolkit::command;
|
use rpc_toolkit::command;
|
||||||
@@ -55,6 +56,10 @@ pub fn restart(#[context] ctx: DiagnosticContext) -> Result<(), Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[command(rename = "forget-disk", display(display_none))]
|
#[command(rename = "forget-disk", display(display_none))]
|
||||||
pub fn forget_disk(#[context] ctx: DiagnosticContext) -> Result<(), Error> {
|
pub async fn forget_disk() -> Result<(), Error> {
|
||||||
todo!()
|
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
|
// 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
|
// 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.
|
// is likely iterating through packages in a different order.
|
||||||
// crate::db::DatabaseModel::new()
|
crate::db::DatabaseModel::new()
|
||||||
// .package_data()
|
.package_data()
|
||||||
// .lock(&mut db)
|
.lock(&mut db, true)
|
||||||
// .await;
|
.await;
|
||||||
|
|
||||||
// Without the above lock, the below check operation will deadlock
|
// Without the above lock, the below check operation will deadlock
|
||||||
let (mut status, manager) = if let Some(installed) = crate::db::DatabaseModel::new()
|
let (mut status, manager) = if let Some(installed) = crate::db::DatabaseModel::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user