mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-26 15:32:18 +00:00
Hide nodes that failed breakers from index page
This commit is contained in:
parent
60abec2b96
commit
795d3238ad
|
@ -93,6 +93,10 @@ impl State {
|
|||
self.object_cache.write().unwrap().put(object_id, actor_id);
|
||||
}
|
||||
|
||||
pub(crate) fn is_connected(&self, iri: &IriString) -> bool {
|
||||
self.breakers.should_try(iri)
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", name = "Building state", skip_all)]
|
||||
pub(crate) async fn build(db: Db) -> Result<Self, Error> {
|
||||
let private_key = if let Ok(Some(key)) = db.private_key().await {
|
||||
|
|
|
@ -39,7 +39,7 @@ impl std::fmt::Debug for Breakers {
|
|||
}
|
||||
|
||||
impl Breakers {
|
||||
fn should_try(&self, url: &IriString) -> bool {
|
||||
pub(crate) fn should_try(&self, url: &IriString) -> bool {
|
||||
if let Some(authority) = url.authority_str() {
|
||||
if let Some(breaker) = self.inner.get(authority) {
|
||||
breaker.should_try()
|
||||
|
|
|
@ -42,6 +42,10 @@ pub(crate) async fn route(
|
|||
let mut local = Vec::new();
|
||||
|
||||
for node in all_nodes {
|
||||
if !state.is_connected(&node.base) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if node
|
||||
.base
|
||||
.authority_str()
|
||||
|
|
Loading…
Reference in New Issue
Block a user