Content-Length: 227205 | pFad | https://github.com/sebadob/rauthy/commit/9bbaeb2f0b582838398547ddb477b7f8ab537a30

FF Merge pull request #154 from sebadob/health-watch-fix-2 · sebadob/rauthy@9bbaeb2 · GitHub
Skip to content

Commit

Permalink
Merge pull request #154 from sebadob/health-watch-fix-2
Browse files Browse the repository at this point in the history
fix health watcher in HA mode
  • Loading branch information
sebadob authored Nov 7, 2023
2 parents 93d75d5 + 96f1b09 commit 9bbaeb2
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions rauthy-models/src/events/health_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ pub async fn watch_health(
let hs = rx_cache.borrow().clone();
let cache_healthy = match hs {
// non-HA cache is always healthy in non-HA mode
None => !!*HA_MODE,
None => !*HA_MODE,

Some(hs) => {
if is_cache_bad(&hs) {
if hs.health != QuorumHealth::Good {
// wait for a few seconds and try again before alerting
tokio::time::sleep(Duration::from_secs(10)).await;

// cannot be None anymore at this point
let hs = rx_cache.borrow().clone().unwrap();
if is_cache_bad(&hs) && was_healthy_after_startup {
if hs.health != QuorumHealth::Good && was_healthy_after_startup {
tx_events
.send_async(Event::rauthy_unhealthy_cache())
.await
Expand Down Expand Up @@ -79,9 +79,3 @@ pub async fn watch_health(
last_state = is_good_now;
}
}

fn is_cache_bad(hs: &QuorumHealthState) -> bool {
!(hs.health == QuorumHealth::Bad
|| hs.state == QuorumState::Undefined
|| hs.state == QuorumState::Retry)
}

0 comments on commit 9bbaeb2

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/sebadob/rauthy/commit/9bbaeb2f0b582838398547ddb477b7f8ab537a30

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy