diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index a2bdf33c2..f1fbbb9c3 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -32,10 +32,10 @@ static WORK_FINISHED_RECHECK_DELAY: Duration = Duration::from_secs(1); static WORK_FINISHED_RECHECK_DELAY: Duration = Duration::from_secs(30); #[cfg(debug_assertions)] static FOLLOW_ADDITIONS_RECHECK_DELAY: Lazy = - Lazy::new(|| chrono::Duration::seconds(1)); + Lazy::new(|| chrono::Duration::minutes(1)); #[cfg(not(debug_assertions))] static FOLLOW_ADDITIONS_RECHECK_DELAY: Lazy = - Lazy::new(|| chrono::Duration::minutes(1)); + Lazy::new(|| chrono::Duration::minutes(5)); static FOLLOW_REMOVALS_RECHECK_DELAY: Lazy = Lazy::new(|| chrono::Duration::hours(1)); pub(crate) struct InstanceWorker { @@ -254,7 +254,8 @@ impl InstanceWorker { .send_inboxes .iter() .filter_map(std::option::Option::as_ref) - .filter_map(|u| (u.domain() == Some(&self.instance.domain)).then(|| u.inner().clone())), + .filter(|&u| (u.domain() == Some(&self.instance.domain))) + .map(|u| u.inner().clone()), ); Ok(inbox_urls) } @@ -295,7 +296,7 @@ impl InstanceWorker { .await? .into_iter() .fold(HashMap::new(), |mut map, (c, u)| { - map.entry(c).or_insert_with(HashSet::new).insert(u.into()); + map.entry(c).or_default().insert(u.into()); map }), new_last_fetch, diff --git a/migrations/2023-09-12-194850_add_federation_worker_index/down.sql b/migrations/2023-09-12-194850_add_federation_worker_index/down.sql new file mode 100644 index 000000000..a203e8087 --- /dev/null +++ b/migrations/2023-09-12-194850_add_federation_worker_index/down.sql @@ -0,0 +1,2 @@ +DROP INDEX idx_person_local_instance; + diff --git a/migrations/2023-09-12-194850_add_federation_worker_index/up.sql b/migrations/2023-09-12-194850_add_federation_worker_index/up.sql new file mode 100644 index 000000000..bbbab0b1f --- /dev/null +++ b/migrations/2023-09-12-194850_add_federation_worker_index/up.sql @@ -0,0 +1,2 @@ +CREATE INDEX idx_person_local_instance ON person (local DESC, instance_id); +