mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-01-10 21:44:34 +01:00
Implements the legacy behaviour of the dump
When asked if a dump exists we check if it's the current dump, and if it's not then we check on the filesystem for any file matching our `uid.dump`
This commit is contained in:
parent
4cbf866821
commit
8a11c6c429
@ -182,12 +182,20 @@ where
|
|||||||
|
|
||||||
async fn handle_dump_info(&self, uid: String) -> DumpResult<DumpInfo> {
|
async fn handle_dump_info(&self, uid: String) -> DumpResult<DumpInfo> {
|
||||||
match &*self.dump_info.lock().await {
|
match &*self.dump_info.lock().await {
|
||||||
None => Err(DumpError::DumpDoesNotExist(uid)),
|
None => self.dump_from_fs(uid).await,
|
||||||
Some(DumpInfo { uid: ref s, .. }) if &uid != s => Err(DumpError::DumpDoesNotExist(uid)),
|
Some(DumpInfo { uid: ref s, .. }) if &uid != s => self.dump_from_fs(uid).await,
|
||||||
Some(info) => Ok(info.clone()),
|
Some(info) => Ok(info.clone()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn dump_from_fs(&self, uid: String) -> DumpResult<DumpInfo> {
|
||||||
|
self.dump_path
|
||||||
|
.join(format!("{}.dump", &uid))
|
||||||
|
.exists()
|
||||||
|
.then(|| DumpInfo::new(uid.clone(), DumpStatus::Done))
|
||||||
|
.ok_or(DumpError::DumpDoesNotExist(uid))
|
||||||
|
}
|
||||||
|
|
||||||
async fn is_running(&self) -> bool {
|
async fn is_running(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
*self.dump_info.lock().await,
|
*self.dump_info.lock().await,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user