mirror of
https://github.com/YGGverse/aquatic-crawler.git
synced 2026-04-03 02:25:30 +00:00
prevent unexpected memory usage by filter values from unknown source
This commit is contained in:
parent
203c3041d2
commit
57b246a879
3 changed files with 42 additions and 13 deletions
16
src/index.rs
16
src/index.rs
|
|
@ -1,11 +1,7 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use std::collections::HashMap;
|
||||
mod value;
|
||||
|
||||
pub struct Value {
|
||||
pub time: DateTime<Utc>,
|
||||
pub node: u64,
|
||||
pub name: Option<String>,
|
||||
}
|
||||
use std::collections::HashMap;
|
||||
use value::Value;
|
||||
|
||||
/// Collect processed info hashes to skip on the next iterations (for this session)
|
||||
/// * also contains optional meta info to export index as RSS or any other format
|
||||
|
|
@ -52,11 +48,7 @@ impl Index {
|
|||
.index
|
||||
.insert(
|
||||
infohash,
|
||||
Value {
|
||||
time: Utc::now(),
|
||||
node,
|
||||
name: if self.has_name { name } else { None },
|
||||
},
|
||||
Value::new(node, if self.has_name { name } else { None }),
|
||||
)
|
||||
.is_none()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue