hunter/worker: don't pass host to save_post()
This commit is contained in:
parent
44a3d68201
commit
2fdd0e079b
|
@ -2,7 +2,8 @@ use crate::feed::{Post, Tag};
|
||||||
|
|
||||||
const POST_EXPIRE: usize = 86400;
|
const POST_EXPIRE: usize = 86400;
|
||||||
|
|
||||||
pub async fn save_post(man: &mut redis::aio::ConnectionManager, host: &str, post: Post) -> bool {
|
// TODO: make state obj w/ ConnectionManager
|
||||||
|
pub async fn save_post(man: &mut redis::aio::ConnectionManager, post: Post) -> bool {
|
||||||
let post_key = format!("p:{}", post.uri);
|
let post_key = format!("p:{}", post.uri);
|
||||||
let check = redis::pipe()
|
let check = redis::pipe()
|
||||||
.getset(&post_key, "1")
|
.getset(&post_key, "1")
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub fn fetch_and_process(
|
||||||
// check if it's an actual post, not a repost
|
// check if it's an actual post, not a repost
|
||||||
if let Some(author_host) = post.account.host() {
|
if let Some(author_host) = post.account.host() {
|
||||||
// send away to redis
|
// send away to redis
|
||||||
if crate::redis_store::save_post(&mut redis_man, &host, post).await {
|
if crate::redis_store::save_post(&mut redis_man, post).await {
|
||||||
new_posts += 1;
|
new_posts += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user