mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
Remove key from index_tasks database when the value is empty
This commit is contained in:
parent
169f386418
commit
28bd8b6c6b
@ -19,7 +19,6 @@ succeeded [2,3,]
|
|||||||
"taskDeletion" [2,3,]
|
"taskDeletion" [2,3,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Tasks:
|
### Index Tasks:
|
||||||
catto []
|
|
||||||
doggo [1,]
|
doggo [1,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Mapper:
|
### Index Mapper:
|
||||||
|
@ -18,7 +18,6 @@ succeeded [2,]
|
|||||||
"taskDeletion" [2,]
|
"taskDeletion" [2,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Tasks:
|
### Index Tasks:
|
||||||
catto []
|
|
||||||
doggo [1,]
|
doggo [1,]
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
### Index Mapper:
|
### Index Mapper:
|
||||||
|
@ -112,15 +112,6 @@ impl IndexScheduler {
|
|||||||
Ok(self.index_tasks.get(rtxn, index)?.unwrap_or_default())
|
Ok(self.index_tasks.get(rtxn, index)?.unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn put_index(
|
|
||||||
&self,
|
|
||||||
wtxn: &mut RwTxn,
|
|
||||||
index: &str,
|
|
||||||
bitmap: &RoaringBitmap,
|
|
||||||
) -> Result<()> {
|
|
||||||
Ok(self.index_tasks.put(wtxn, index, bitmap)?)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn update_index(
|
pub(crate) fn update_index(
|
||||||
&self,
|
&self,
|
||||||
wtxn: &mut RwTxn,
|
wtxn: &mut RwTxn,
|
||||||
@ -129,7 +120,11 @@ impl IndexScheduler {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut tasks = self.index_tasks(wtxn, index)?;
|
let mut tasks = self.index_tasks(wtxn, index)?;
|
||||||
f(&mut tasks);
|
f(&mut tasks);
|
||||||
self.put_index(wtxn, index, &tasks)?;
|
if tasks.is_empty() {
|
||||||
|
self.index_tasks.delete(wtxn, index)?;
|
||||||
|
} else {
|
||||||
|
self.index_tasks.put(wtxn, index, &tasks)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user