Reset breakers when receiving activities

This commit is contained in:
asonix 2022-11-16 14:29:57 -06:00
parent 2c4901d3fc
commit 448a907ab0
2 changed files with 7 additions and 0 deletions

View file

@ -26,6 +26,9 @@ impl MyVerify {
) -> Result<bool, Error> { ) -> Result<bool, Error> {
let public_key_id = iri!(key_id); let public_key_id = iri!(key_id);
// receiving an activity from a domain indicates it is probably online
self.0.reset_breaker(&public_key_id);
let actor_id = if let Some(mut actor_id) = self let actor_id = if let Some(mut actor_id) = self
.2 .2
.db .db

View file

@ -187,6 +187,10 @@ impl Requests {
} }
} }
pub(crate) fn reset_breaker(&self, iri: &IriString) {
self.breakers.succeed(iri);
}
fn count_err(&self) { fn count_err(&self) {
let count = self.consecutive_errors.fetch_add(1, Ordering::Relaxed); let count = self.consecutive_errors.fetch_add(1, Ordering::Relaxed);
if count + 1 >= self.error_limit { if count + 1 >= self.error_limit {