mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fix non-canonical lock orderings
This commit is contained in:
committed by
Aiden McClelland
parent
be98fdfeed
commit
36d5d40b4f
@@ -1,7 +1,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use color_eyre::eyre::eyre;
|
||||
use patch_db::DbHandle;
|
||||
use patch_db::{DbHandle, LockType};
|
||||
use rpc_toolkit::command;
|
||||
use tracing::instrument;
|
||||
|
||||
@@ -25,6 +25,10 @@ pub async fn start(
|
||||
) -> Result<WithRevision<()>, Error> {
|
||||
let mut db = ctx.db.handle();
|
||||
let mut tx = db.begin().await?;
|
||||
crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.lock(&mut tx, LockType::Write)
|
||||
.await?;
|
||||
let installed = crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.idx_model(&id)
|
||||
@@ -37,6 +41,7 @@ pub async fn start(
|
||||
format!("{} is not installed", id),
|
||||
)
|
||||
})?;
|
||||
installed.lock(&mut tx, LockType::Read).await?;
|
||||
let version = installed
|
||||
.clone()
|
||||
.manifest()
|
||||
|
||||
@@ -6,7 +6,7 @@ use color_eyre::eyre::eyre;
|
||||
use emver::VersionRange;
|
||||
use futures::future::BoxFuture;
|
||||
use futures::FutureExt;
|
||||
use patch_db::{DbHandle, HasModel, Map, MapModel, PatchDbHandle};
|
||||
use patch_db::{DbHandle, HasModel, LockType, Map, MapModel, PatchDbHandle};
|
||||
use rand::SeedableRng;
|
||||
use rpc_toolkit::command;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -535,6 +535,10 @@ pub async fn configure_logic(
|
||||
db: &mut PatchDbHandle,
|
||||
(pkg_id, dependency_id): (PackageId, PackageId),
|
||||
) -> Result<ConfigDryRes, Error> {
|
||||
crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.lock(db, LockType::Read)
|
||||
.await?;
|
||||
let pkg_model = crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.idx_model(&pkg_id)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use patch_db::DbHandle;
|
||||
use patch_db::{DbHandle, LockType};
|
||||
use tracing::instrument;
|
||||
|
||||
use crate::context::RpcContext;
|
||||
@@ -64,6 +64,11 @@ pub async fn check<Db: DbHandle>(
|
||||
|
||||
let mut checkpoint = tx.begin().await?;
|
||||
|
||||
crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.lock(&mut checkpoint, LockType::Write)
|
||||
.await?;
|
||||
|
||||
let mut status = crate::db::DatabaseModel::new()
|
||||
.package_data()
|
||||
.idx_model(id)
|
||||
|
||||
Reference in New Issue
Block a user