mirror of
https://github.com/romanz/electrs.git
synced 2025-02-22 22:36:37 +01:00
parent
87752803ae
commit
4af15e90be
2 changed files with 8 additions and 1 deletions
|
@ -281,6 +281,7 @@ impl DBStore {
|
|||
}
|
||||
|
||||
pub(crate) fn flush(&self) {
|
||||
debug!("flushing DB column families");
|
||||
let mut config = self.get_config().unwrap_or_default();
|
||||
for name in COLUMN_FAMILIES {
|
||||
let cf = self.db.cf_handle(name).expect("missing CF");
|
||||
|
|
|
@ -86,6 +86,7 @@ pub struct Index {
|
|||
chain: Chain,
|
||||
stats: Stats,
|
||||
is_ready: bool,
|
||||
flush_needed: bool,
|
||||
}
|
||||
|
||||
impl Index {
|
||||
|
@ -117,6 +118,7 @@ impl Index {
|
|||
chain,
|
||||
stats,
|
||||
is_ready: false,
|
||||
flush_needed: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -179,7 +181,10 @@ impl Index {
|
|||
);
|
||||
}
|
||||
_ => {
|
||||
self.store.flush(); // full compaction is performed on the first flush call
|
||||
if self.flush_needed {
|
||||
self.store.flush(); // full compaction is performed on the first flush call
|
||||
self.flush_needed = false;
|
||||
}
|
||||
self.is_ready = true;
|
||||
return Ok(true); // no more blocks to index (done for now)
|
||||
}
|
||||
|
@ -195,6 +200,7 @@ impl Index {
|
|||
}
|
||||
self.chain.update(new_headers);
|
||||
self.stats.observe_chain(&self.chain);
|
||||
self.flush_needed = true;
|
||||
Ok(false) // sync is not done
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue