mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fix deadlock
This commit is contained in:
@@ -97,6 +97,7 @@ pub async fn recover_full_embassy(
|
||||
|
||||
let db = ctx.db().await?;
|
||||
db.put(&ROOT, &Database::init(&os_backup.account)?).await?;
|
||||
drop(db);
|
||||
|
||||
init(&ctx.config).await?;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
use std::panic::UnwindSafe;
|
||||
use std::str::FromStr;
|
||||
@@ -30,19 +31,17 @@ where
|
||||
patch_db::value::from_value(value).with_kind(ErrorKind::Deserialization)
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait PatchDbExt {
|
||||
async fn peek(&self) -> DatabaseModel;
|
||||
async fn mutate<U: UnwindSafe + Send>(
|
||||
fn peek(&self) -> impl Future<Output = DatabaseModel> + Send;
|
||||
fn mutate<U: UnwindSafe + Send>(
|
||||
&self,
|
||||
f: impl FnOnce(&mut DatabaseModel) -> Result<U, Error> + UnwindSafe + Send,
|
||||
) -> Result<U, Error>;
|
||||
async fn map_mutate(
|
||||
) -> impl Future<Output = Result<U, Error>> + Send;
|
||||
fn map_mutate(
|
||||
&self,
|
||||
f: impl FnOnce(DatabaseModel) -> Result<DatabaseModel, Error> + UnwindSafe + Send,
|
||||
) -> Result<DatabaseModel, Error>;
|
||||
) -> impl Future<Output = Result<DatabaseModel, Error>> + Send;
|
||||
}
|
||||
#[async_trait::async_trait]
|
||||
impl PatchDbExt for PatchDb {
|
||||
async fn peek(&self) -> DatabaseModel {
|
||||
DatabaseModel::from(self.dump(&ROOT).await.value)
|
||||
|
||||
@@ -60,7 +60,7 @@ pub(self) async fn default_mount_command(
|
||||
cmd.arg(source.as_ref());
|
||||
}
|
||||
cmd.arg(mountpoint.as_ref());
|
||||
Ok(dbg!(cmd))
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
pub(self) async fn default_mount_impl(
|
||||
|
||||
@@ -419,6 +419,7 @@ async fn fresh_setup(
|
||||
let account = AccountInfo::new(embassy_password, root_ca_start_time().await?)?;
|
||||
let db = ctx.db().await?;
|
||||
db.put(&ROOT, &Database::init(&account)?).await?;
|
||||
drop(db);
|
||||
init(&ctx.config).await?;
|
||||
Ok((
|
||||
account.hostname,
|
||||
|
||||
Reference in New Issue
Block a user