diff --git a/parser/src/actions/iter_blocks.rs b/parser/src/actions/iter_blocks.rs index 783670033..8b4e19938 100644 --- a/parser/src/actions/iter_blocks.rs +++ b/parser/src/actions/iter_blocks.rs @@ -14,7 +14,7 @@ use crate::{ states::{AddressCohortsDurableStates, States, UTXOCohortsDurableStates}, structs::{DateData, MapKey, Timestamp, RAM}, utils::{generate_allocation_files, log, time}, - Config, Date, Exit, Height, + Config, Exit, Height, }; pub fn iter_blocks( @@ -175,9 +175,11 @@ pub fn iter_blocks( if is_date_last_block { height += blocks_loop_i; - let is_new_year = next_block_date.as_ref().map_or(true, Date::is_new_year); + let is_check_point = next_block_date.as_ref().map_or(true, |date| { + date.is_first_of_january() || date.is_first_of_june() + }); - if is_new_year + if is_check_point || ram.max_exceeded(config) || height.is_close_to_end(approx_block_count) { diff --git a/parser/src/databases/metadata.rs b/parser/src/databases/metadata.rs index 1081f69aa..e43b62d45 100644 --- a/parser/src/databases/metadata.rs +++ b/parser/src/databases/metadata.rs @@ -38,7 +38,7 @@ impl Metadata { pub fn import(path: &str, version: u16) -> Self { Self { path: path.to_owned(), - data: MetadataData::import(path, version).unwrap_or_default(), + data: MetadataData::import(path, version), } } @@ -95,7 +95,13 @@ impl MetadataData { format!("{folder_path}/{name}") } - pub fn import(path: &str, version: u16) -> color_eyre::Result { + pub fn import(path: &str, version: u16) -> Self { + let mut s = Self::_import(path, version).unwrap_or_default(); + s.version = version; + s + } + + fn _import(path: &str, version: u16) -> color_eyre::Result { fs::create_dir_all(path)?; let s: MetadataData = Serialization::Binary.import(Path::new(&Self::full_path(path)))?; diff --git a/parser/src/structs/config.rs b/parser/src/structs/config.rs index d7b8da779..5f2d03d56 100644 --- a/parser/src/structs/config.rs +++ b/parser/src/structs/config.rs @@ -32,7 +32,7 @@ pub struct Config { #[arg(long, value_name = "SECONDS")] pub delay: Option, - /// Maximum ram you want the program to use in GB, default: 75% of total, not saved + /// Maximum ram you want the program to use in GB, default: 50% of total, not saved #[arg(long, value_name = "GB")] pub max_ram: Option, diff --git a/parser/src/structs/date.rs b/parser/src/structs/date.rs index 44c7702b6..ef9c619f2 100644 --- a/parser/src/structs/date.rs +++ b/parser/src/structs/date.rs @@ -74,9 +74,13 @@ impl Date { } } - pub fn is_new_year(&self) -> bool { + pub fn is_first_of_january(&self) -> bool { self.day() == 1 && self.month() == 1 } + + pub fn is_first_of_june(&self) -> bool { + self.day() == 1 && self.month() == 6 + } } impl MapKey for Date { diff --git a/parser/src/structs/ram.rs b/parser/src/structs/ram.rs index 108edb3cc..05e4ecc8a 100644 --- a/parser/src/structs/ram.rs +++ b/parser/src/structs/ram.rs @@ -20,7 +20,7 @@ impl RAM { (ram_used / 1_000_000_000.0) > max_ram } else { let ram_total = self.total_memory() as f64; - ram_used / ram_total > 0.75 + ram_used / ram_total > 0.5 } } }