cave/block_list: move from hunter

This commit is contained in:
Astro 2023-10-18 02:03:41 +02:00
parent 35782d3617
commit f656daf07a
4 changed files with 9 additions and 5 deletions

View File

@ -57,7 +57,7 @@ pub struct BlockList {
impl BlockList {
pub async fn new(path: &str) -> BlockList {
let root = cave::live_file::load(path, |file| async move {
let root = crate::live_file::load(path, |file| async move {
let mut root = Leaf::Tree(HashMap::new());
let mut file = BufReader::new(file);
let mut line = String::new();

View File

@ -10,6 +10,8 @@ pub mod word_list;
pub mod db;
pub mod posts_cache;
pub mod activitypub;
pub mod block_list;
pub const PERIODS: &[u64] = &[4, 24, 7 * 24];

View File

@ -3,10 +3,12 @@ use futures::{StreamExt, pin_mut};
use metrics_util::MetricKindMask;
use metrics_exporter_prometheus::PrometheusBuilder;
use tokio::time::timeout;
use cave::config::LoadConfig;
use cave::{
block_list::BlockList,
config::LoadConfig,
};
mod config;
mod block_list;
mod scheduler;
mod worker;
mod webfinger;
@ -43,7 +45,7 @@ async fn run() {
let mut store = cave::store::Store::new(16, config.redis, config.redis_password_file).await;
let posts_cache = cave::posts_cache::PostsCache::new(65536);
let block_list = block_list::BlockList::new(&config.blocklist).await;
let block_list = BlockList::new(&config.blocklist).await;
cave::systemd::status("Starting scheduler");
let mut scheduler = scheduler::Scheduler::new(block_list);

View File

@ -5,7 +5,7 @@ use cave::feed::{Mention, Account};
use rand::{thread_rng, Rng};
use tokio::time::Instant;
use crate::block_list::BlockList;
use cave::block_list::BlockList;
const MIN_INTERVAL: Duration = Duration::from_secs(30);
const MAX_INTERVAL: Duration = Duration::from_secs(6 * 3600);