mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 18:31:53 +00:00
fix deadlock
This commit is contained in:
committed by
Aiden McClelland
parent
d84752007d
commit
43e3c77c14
@@ -19,6 +19,7 @@ mod test;
|
||||
|
||||
pub use handle::{DbHandle, PatchDbHandle};
|
||||
pub use json_ptr;
|
||||
pub use json_patch;
|
||||
pub use locker::{LockType, Locker};
|
||||
pub use model::{
|
||||
BoxModel, HasModel, Map, MapModel, Model, ModelData, ModelDataMut, OptionModel, VecModel,
|
||||
|
||||
@@ -29,10 +29,13 @@ pub struct Transaction<Parent: DbHandle> {
|
||||
impl Transaction<&mut PatchDbHandle> {
|
||||
pub async fn commit(mut self, expire_id: Option<String>) -> Result<Arc<Revision>, Error> {
|
||||
let store_lock = self.parent.store();
|
||||
let store = store_lock.read().await;
|
||||
let store = store_lock.write().await;
|
||||
self.rebase()?;
|
||||
let rev = self.parent.db.apply(self.updates, expire_id, None).await?;
|
||||
drop(store);
|
||||
let rev = self
|
||||
.parent
|
||||
.db
|
||||
.apply(self.updates, expire_id, Some(store))
|
||||
.await?;
|
||||
Ok(rev)
|
||||
}
|
||||
pub async fn abort(mut self) -> Result<DiffPatch, Error> {
|
||||
|
||||
Reference in New Issue
Block a user