mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-22 16:11:38 +03:00
fixes
This commit is contained in:
parent
b87cfbc674
commit
03b531ef64
@ -48,6 +48,9 @@ impl KvState {
|
|||||||
pub async fn open_db(&mut self, package_id: PackageId, db: String) -> Result<(), KvError> {
|
pub async fn open_db(&mut self, package_id: PackageId, db: String) -> Result<(), KvError> {
|
||||||
let key = (package_id.clone(), db.clone());
|
let key = (package_id.clone(), db.clone());
|
||||||
if self.open_kvs.contains_key(&key) {
|
if self.open_kvs.contains_key(&key) {
|
||||||
|
let mut access_order = self.access_order.lock().await;
|
||||||
|
access_order.remove(&key);
|
||||||
|
access_order.push_back(key);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,10 +500,11 @@ async fn check_caps(
|
|||||||
.remove_db(request.package_id.clone(), request.db.clone())
|
.remove_db(request.package_id.clone(), request.db.clone())
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let _ = fs::remove_dir_all(format!(
|
fs::remove_dir_all(format!(
|
||||||
"{}/{}/{}",
|
"{}/{}/{}",
|
||||||
state.kv_path, request.package_id, request.db
|
state.kv_path, request.package_id, request.db
|
||||||
));
|
))
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@ impl SqliteState {
|
|||||||
pub async fn open_db(&mut self, package_id: PackageId, db: String) -> Result<(), SqliteError> {
|
pub async fn open_db(&mut self, package_id: PackageId, db: String) -> Result<(), SqliteError> {
|
||||||
let key = (package_id.clone(), db.clone());
|
let key = (package_id.clone(), db.clone());
|
||||||
if self.open_dbs.contains_key(&key) {
|
if self.open_dbs.contains_key(&key) {
|
||||||
// let mut access_order = self.access_order.lock().await;
|
let mut access_order = self.access_order.lock().await;
|
||||||
// access_order.remove(&key);
|
access_order.remove(&key);
|
||||||
// access_order.push_back(key);
|
access_order.push_back(key);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,10 +515,11 @@ async fn check_caps(
|
|||||||
.remove_db(request.package_id.clone(), request.db.clone())
|
.remove_db(request.package_id.clone(), request.db.clone())
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let _ = fs::remove_dir_all(format!(
|
fs::remove_dir_all(format!(
|
||||||
"{}/{}/{}",
|
"{}/{}/{}",
|
||||||
state.sqlite_path, request.package_id, request.db
|
state.sqlite_path, request.package_id, request.db
|
||||||
));
|
))
|
||||||
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user