Add breakers for requests to down domains

This commit is contained in:
asonix
2020-12-23 12:06:15 -06:00
parent 55cb25f54b
commit e2da563a1c
5 changed files with 552 additions and 348 deletions
+4 -1
View File
@@ -3,7 +3,7 @@ use crate::{
data::NodeCache,
db::Db,
error::MyError,
requests::Requests,
requests::{Breakers, Requests},
};
use activitystreams::url::Url;
use actix_rt::{
@@ -29,6 +29,7 @@ pub struct State {
whitelists: Arc<RwLock<HashSet<String>>>,
listeners: Arc<RwLock<HashSet<Url>>>,
node_cache: NodeCache,
breakers: Breakers,
}
impl State {
@@ -46,6 +47,7 @@ impl State {
self.config.software_version(),
self.config.generate_url(UrlKind::Index),
),
self.breakers.clone(),
)
}
@@ -188,6 +190,7 @@ impl State {
whitelists: Arc::new(RwLock::new(whitelists)),
listeners: listeners.clone(),
node_cache: NodeCache::new(db.clone(), listeners),
breakers: Breakers::default(),
};
state.spawn_rehydrate(db.clone());