correctness on search-server1
This commit is contained in:
Submodule client-gui2 updated: bcd89bc641...4611db6c6c
@@ -160,12 +160,16 @@ impl SearcherService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn invalidate_profile(&self, profile_name: &str) -> Result<(), Status> {
|
pub fn replace_profile_index(
|
||||||
self.profiles
|
&self,
|
||||||
|
profile_name: &str,
|
||||||
|
replace: impl FnOnce() -> anyhow::Result<()>,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
let mut profiles = self.profiles
|
||||||
.lock()
|
.lock()
|
||||||
.map_err(|_| Status::internal("Profile index cache lock poisoned"))?
|
.map_err(|_| anyhow::anyhow!("Profile index cache lock poisoned"))?;
|
||||||
.remove(profile_name);
|
profiles.remove(profile_name);
|
||||||
Ok(())
|
replace()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run_rpc(
|
async fn run_rpc(
|
||||||
@@ -721,22 +725,13 @@ fn profile_index(
|
|||||||
profile_name: &str,
|
profile_name: &str,
|
||||||
path: &Path,
|
path: &Path,
|
||||||
) -> Result<Arc<ProfileIndex>, Status> {
|
) -> Result<Arc<ProfileIndex>, Status> {
|
||||||
{
|
|
||||||
let cache_guard = cache
|
|
||||||
.lock()
|
|
||||||
.map_err(|_| Status::internal("Profile index cache lock poisoned"))?;
|
|
||||||
if let Some(index) = cache_guard.get(profile_name) {
|
|
||||||
return Ok(index.clone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let opened = Arc::new(ProfileIndex::open(path)?);
|
|
||||||
let mut cache_guard = cache
|
let mut cache_guard = cache
|
||||||
.lock()
|
.lock()
|
||||||
.map_err(|_| Status::internal("Profile index cache lock poisoned"))?;
|
.map_err(|_| Status::internal("Profile index cache lock poisoned"))?;
|
||||||
if let Some(index) = cache_guard.get(profile_name) {
|
if let Some(index) = cache_guard.get(profile_name) {
|
||||||
return Ok(index.clone());
|
return Ok(index.clone());
|
||||||
}
|
}
|
||||||
|
let opened = Arc::new(ProfileIndex::open(path)?);
|
||||||
cache_guard.insert(profile_name.to_string(), opened.clone());
|
cache_guard.insert(profile_name.to_string(), opened.clone());
|
||||||
Ok(opened)
|
Ok(opened)
|
||||||
}
|
}
|
||||||
|
|||||||
2
server
2
server
Submodule server updated: 5455e7cb3a...2cf38b6882
Reference in New Issue
Block a user