cave: move posts_cache from hunter

This commit is contained in:
Astro 2023-10-12 23:28:48 +02:00
parent a6a6afbf33
commit fe0d19fbc6
6 changed files with 5 additions and 3 deletions

1
Cargo.lock generated
View File

@ -369,6 +369,7 @@ dependencies = [
"eventsource-stream", "eventsource-stream",
"futures", "futures",
"inotify", "inotify",
"metrics",
"redis", "redis",
"reqwest", "reqwest",
"serde", "serde",

View File

@ -21,3 +21,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
inotify = "0.10" inotify = "0.10"
tokio-postgres = "0.7" tokio-postgres = "0.7"
url = "2" url = "2"
metrics = "0.20"

View File

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

View File

@ -9,7 +9,6 @@ mod config;
mod block_list; mod block_list;
mod scheduler; mod scheduler;
mod worker; mod worker;
mod posts_cache;
mod webfinger; mod webfinger;
use scheduler::InstanceHost; use scheduler::InstanceHost;
@ -42,7 +41,7 @@ async fn run() {
let db = cave::db::Database::connect(&config.database).await; let db = cave::db::Database::connect(&config.database).await;
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 = 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 = block_list::BlockList::new(&config.blocklist).await;

View File

@ -5,11 +5,11 @@ use std::time::{Duration, Instant};
use cave::{ use cave::{
db::Database, db::Database,
feed::{Feed, EncodablePost, Post, StreamError}, feed::{Feed, EncodablePost, Post, StreamError},
posts_cache::PostsCache,
store::Store, store::Store,
}; };
use futures::{StreamExt, future}; use futures::{StreamExt, future};
use reqwest::StatusCode; use reqwest::StatusCode;
use crate::posts_cache::PostsCache;
use crate::scheduler::{Host, InstanceHost}; use crate::scheduler::{Host, InstanceHost};
use crate::webfinger; use crate::webfinger;