cave/block_list: move from hunter
This commit is contained in:
parent
35782d3617
commit
f656daf07a
|
@ -57,7 +57,7 @@ pub struct BlockList {
|
||||||
|
|
||||||
impl BlockList {
|
impl BlockList {
|
||||||
pub async fn new(path: &str) -> 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 root = Leaf::Tree(HashMap::new());
|
||||||
let mut file = BufReader::new(file);
|
let mut file = BufReader::new(file);
|
||||||
let mut line = String::new();
|
let mut line = String::new();
|
|
@ -10,6 +10,8 @@ pub mod word_list;
|
||||||
pub mod db;
|
pub mod db;
|
||||||
pub mod posts_cache;
|
pub mod posts_cache;
|
||||||
pub mod activitypub;
|
pub mod activitypub;
|
||||||
|
pub mod block_list;
|
||||||
|
|
||||||
|
|
||||||
pub const PERIODS: &[u64] = &[4, 24, 7 * 24];
|
pub const PERIODS: &[u64] = &[4, 24, 7 * 24];
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,12 @@ use futures::{StreamExt, pin_mut};
|
||||||
use metrics_util::MetricKindMask;
|
use metrics_util::MetricKindMask;
|
||||||
use metrics_exporter_prometheus::PrometheusBuilder;
|
use metrics_exporter_prometheus::PrometheusBuilder;
|
||||||
use tokio::time::timeout;
|
use tokio::time::timeout;
|
||||||
use cave::config::LoadConfig;
|
use cave::{
|
||||||
|
block_list::BlockList,
|
||||||
|
config::LoadConfig,
|
||||||
|
};
|
||||||
|
|
||||||
mod config;
|
mod config;
|
||||||
mod block_list;
|
|
||||||
mod scheduler;
|
mod scheduler;
|
||||||
mod worker;
|
mod worker;
|
||||||
mod webfinger;
|
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 mut store = cave::store::Store::new(16, config.redis, config.redis_password_file).await;
|
||||||
let posts_cache = cave::posts_cache::PostsCache::new(65536);
|
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");
|
cave::systemd::status("Starting scheduler");
|
||||||
let mut scheduler = scheduler::Scheduler::new(block_list);
|
let mut scheduler = scheduler::Scheduler::new(block_list);
|
||||||
|
|
|
@ -5,7 +5,7 @@ use cave::feed::{Mention, Account};
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use tokio::time::Instant;
|
use tokio::time::Instant;
|
||||||
|
|
||||||
use crate::block_list::BlockList;
|
use cave::block_list::BlockList;
|
||||||
|
|
||||||
const MIN_INTERVAL: Duration = Duration::from_secs(30);
|
const MIN_INTERVAL: Duration = Duration::from_secs(30);
|
||||||
const MAX_INTERVAL: Duration = Duration::from_secs(6 * 3600);
|
const MAX_INTERVAL: Duration = Duration::from_secs(6 * 3600);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user