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> {
|
||||
self.profiles
|
||||
pub fn replace_profile_index(
|
||||
&self,
|
||||
profile_name: &str,
|
||||
replace: impl FnOnce() -> anyhow::Result<()>,
|
||||
) -> anyhow::Result<()> {
|
||||
let mut profiles = self.profiles
|
||||
.lock()
|
||||
.map_err(|_| Status::internal("Profile index cache lock poisoned"))?
|
||||
.remove(profile_name);
|
||||
Ok(())
|
||||
.map_err(|_| anyhow::anyhow!("Profile index cache lock poisoned"))?;
|
||||
profiles.remove(profile_name);
|
||||
replace()
|
||||
}
|
||||
|
||||
async fn run_rpc(
|
||||
@@ -721,22 +725,13 @@ fn profile_index(
|
||||
profile_name: &str,
|
||||
path: &Path,
|
||||
) -> 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
|
||||
.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)?);
|
||||
cache_guard.insert(profile_name.to_string(), opened.clone());
|
||||
Ok(opened)
|
||||
}
|
||||
|
||||
2
server
2
server
Submodule server updated: 5455e7cb3a...2cf38b6882
Reference in New Issue
Block a user