mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-25 11:01:11 +00:00
Remove re-seed, it's been run in prod already
This commit is contained in:
parent
bd75b1f958
commit
a7b4bc59be
2 changed files with 1 additions and 33 deletions
|
@ -1,6 +1,6 @@
|
||||||
use crate::{apub::AcceptedActors, db::Db, error::MyError, requests::Requests};
|
use crate::{apub::AcceptedActors, db::Db, error::MyError, requests::Requests};
|
||||||
use activitystreams::primitives::XsdAnyUri;
|
use activitystreams::primitives::XsdAnyUri;
|
||||||
use log::{error, info, warn};
|
use log::error;
|
||||||
use std::{collections::HashSet, sync::Arc, time::Duration};
|
use std::{collections::HashSet, sync::Arc, time::Duration};
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use ttl_cache::TtlCache;
|
use ttl_cache::TtlCache;
|
||||||
|
@ -28,34 +28,6 @@ impl ActorCache {
|
||||||
cache
|
cache
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn re_seed(
|
|
||||||
&self,
|
|
||||||
listeners: &[XsdAnyUri],
|
|
||||||
requests: &Requests,
|
|
||||||
) -> Result<(), MyError> {
|
|
||||||
info!("Seeding actors with {:?}", listeners);
|
|
||||||
for listener in listeners {
|
|
||||||
let mut listener = listener.clone();
|
|
||||||
listener.as_url_mut().set_path("/actor");
|
|
||||||
|
|
||||||
let actor = match self.get(&listener, requests).await {
|
|
||||||
Ok(actor) => actor,
|
|
||||||
Err(e) => {
|
|
||||||
warn!("Couldn't seed {} due to {}, continuing", e, listener);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
match self.save(actor).await {
|
|
||||||
Ok(_) => (),
|
|
||||||
Err(e) => {
|
|
||||||
warn!("Coudn't seed {} due to {}, continuing", listener, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn is_following(&self, id: &XsdAnyUri) -> bool {
|
pub async fn is_following(&self, id: &XsdAnyUri) -> bool {
|
||||||
self.following.read().await.contains(id)
|
self.following.read().await.contains(id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,10 +66,6 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
let actors = ActorCache::new(db.clone());
|
let actors = ActorCache::new(db.clone());
|
||||||
let job_server = create_server(db.clone());
|
let job_server = create_server(db.clone());
|
||||||
|
|
||||||
actors
|
|
||||||
.re_seed(&state.listeners().await, &state.requests())
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
notify::spawn(state.clone(), actors.clone(), job_server.clone(), &config)?;
|
notify::spawn(state.clone(), actors.clone(), job_server.clone(), &config)?;
|
||||||
|
|
||||||
if args.jobs_only() {
|
if args.jobs_only() {
|
||||||
|
|
Loading…
Reference in a new issue