mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-29 09:09:58 -07:00
parser: exit inside global defrag
This commit is contained in:
@@ -32,9 +32,7 @@ pub fn iter_blocks(
|
||||
let mut databases = Databases::import();
|
||||
|
||||
if config.first_defragment() {
|
||||
exit.block();
|
||||
databases.defragment();
|
||||
exit.unblock();
|
||||
databases.defragment(&exit);
|
||||
}
|
||||
|
||||
log("Imported databases");
|
||||
|
||||
@@ -28,6 +28,7 @@ use crate::{
|
||||
log,
|
||||
structs::{Date, Height},
|
||||
utils::time,
|
||||
Exit,
|
||||
};
|
||||
|
||||
#[derive(Allocative)]
|
||||
@@ -128,7 +129,9 @@ impl Databases {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn defragment(&mut self) {
|
||||
pub fn defragment(&mut self, exit: &Exit) {
|
||||
exit.block();
|
||||
|
||||
log("Databases defragmentation");
|
||||
|
||||
time("Defragmenting databases", || {
|
||||
@@ -139,7 +142,9 @@ impl Databases {
|
||||
self.drain_to_vec()
|
||||
.into_par_iter()
|
||||
.for_each(AnyDatabase::boxed_defragment);
|
||||
})
|
||||
});
|
||||
|
||||
exit.unblock();
|
||||
}
|
||||
|
||||
pub fn reset(&mut self, include_addresses: bool) {
|
||||
|
||||
Reference in New Issue
Block a user