diff --git a/src/index.rs b/src/index.rs index b78c601..c87df24 100644 --- a/src/index.rs +++ b/src/index.rs @@ -14,13 +14,17 @@ pub struct Index { /// Track index changes to prevent extra disk write operations (safe SSD life) /// * useful in the static RSS feed generation case, if enabled. is_changed: bool, + /// Store index value in memory only on it is in use + /// by the externally defined argument options. + has_name: bool, } impl Index { - pub fn init(capacity: usize) -> Self { + pub fn init(capacity: usize, has_name: bool) -> Self { Self { index: HashMap::with_capacity(capacity), is_changed: false, + has_name, } } @@ -52,7 +56,7 @@ impl Index { Value { time: Utc::now(), node, - name, + name: if self.has_name { name } else { None }, }, ) .is_none() diff --git a/src/main.rs b/src/main.rs index aa8b5dd..49202b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,7 +64,7 @@ async fn main() -> Result<()> { // begin debug.info("Crawler started"); - let mut index = Index::init(config.index_capacity); + let mut index = Index::init(config.index_capacity, config.export_rss.is_some()); loop { debug.info("Index queue begin..."); index.refresh();