mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 06:58:52 +00:00
Addressing PR comments
This commit is contained in:
parent
85124fc39a
commit
12a549ce6a
|
@ -27,7 +27,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
use ::url::Url;
|
||||
use chrono::{TimeDelta, Utc};
|
||||
use chrono::Utc;
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl, TextExpressionMethods};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use std::collections::HashSet;
|
||||
|
@ -105,12 +105,7 @@ impl Post {
|
|||
.filter(post::deleted.eq(false))
|
||||
.filter(post::removed.eq(false))
|
||||
.filter(
|
||||
post::published.ge(
|
||||
Utc::now().naive_utc()
|
||||
- TimeDelta::try_days(SITEMAP_DAYS)
|
||||
.ok_or("TimeDelta out of bounds")
|
||||
.map_err(|e| Error::QueryBuilderError(e.into()))?,
|
||||
),
|
||||
post::published.ge(Utc::now().naive_utc() - SITEMAP_DAYS.expect("TimeDelta out of bounds")),
|
||||
)
|
||||
.order(post::published.desc())
|
||||
.limit(SITEMAP_LIMIT)
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
SortType,
|
||||
};
|
||||
use anyhow::Context;
|
||||
use chrono::{DateTime, Utc};
|
||||
use chrono::{DateTime, TimeDelta, Utc};
|
||||
use deadpool::Runtime;
|
||||
use diesel::{
|
||||
helper_types::AsExprOf,
|
||||
|
@ -51,7 +51,7 @@ use url::Url;
|
|||
const FETCH_LIMIT_DEFAULT: i64 = 10;
|
||||
pub const FETCH_LIMIT_MAX: i64 = 50;
|
||||
pub const SITEMAP_LIMIT: i64 = 50000;
|
||||
pub const SITEMAP_DAYS: i64 = 31;
|
||||
pub const SITEMAP_DAYS: Option<TimeDelta> = TimeDelta::try_days(31);
|
||||
pub const RANK_DEFAULT: f64 = 0.0001;
|
||||
|
||||
pub type ActualDbPool = Pool<AsyncPgConnection>;
|
||||
|
|
|
@ -333,7 +333,7 @@ impl InstanceWorker {
|
|||
last_fetch: DateTime<Utc>,
|
||||
) -> Result<(HashMap<CommunityId, HashSet<Url>>, DateTime<Utc>)> {
|
||||
let new_last_fetch =
|
||||
Utc::now() - chrono::TimeDelta::try_seconds(10).context("TimeDelta out of bounds")?; // update to time before fetch to ensure overlap. subtract 10s to ensure overlap even if published date is not exact
|
||||
Utc::now() - chrono::TimeDelta::try_seconds(10).expect("TimeDelta out of bounds"); // update to time before fetch to ensure overlap. subtract 10s to ensure overlap even if published date is not exact
|
||||
Ok((
|
||||
CommunityFollowerView::get_instance_followed_community_inboxes(pool, instance_id, last_fetch)
|
||||
.await?
|
||||
|
|
Loading…
Reference in a new issue