2 pub mod post_or_comment;
4 pub mod user_or_community;
6 use chrono::NaiveDateTime;
7 use lemmy_db_schema::naive_now;
9 static ACTOR_REFETCH_INTERVAL_SECONDS: i64 = 24 * 60 * 60;
10 static ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG: i64 = 10;
12 /// Determines when a remote actor should be refetched from its instance. In release builds, this is
13 /// `ACTOR_REFETCH_INTERVAL_SECONDS` after the last refetch, in debug builds
14 /// `ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG`.
16 /// TODO it won't pick up new avatars, summaries etc until a day after.
17 /// Actors need an "update" activity pushed to other servers to fix this.
18 fn should_refetch_object(last_refreshed: NaiveDateTime) -> bool {
19 let update_interval = if cfg!(debug_assertions) {
20 // avoid infinite loop when fetching community outbox
21 chrono::Duration::seconds(ACTOR_REFETCH_INTERVAL_SECONDS_DEBUG)
23 chrono::Duration::seconds(ACTOR_REFETCH_INTERVAL_SECONDS)
25 last_refreshed.lt(&(naive_now() - update_interval))