Fix nodes not being marked as available

This commit is contained in:
Mac L
2023-06-22 11:51:30 +10:00
parent 5153aff196
commit 61bc700fdf
2 changed files with 6 additions and 5 deletions

View File

@@ -207,7 +207,7 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
) -> Result<(), CandidateError> { ) -> Result<(), CandidateError> {
if let Err(e) = self.is_compatible(spec, log).await { if let Err(e) = self.is_compatible(spec, log).await {
*self.health.write() = Err(e); *self.health.write() = Err(e);
return Ok(()); return Err(e);
} }
if let Some(slot_clock) = slot_clock { if let Some(slot_clock) = slot_clock {
@@ -243,7 +243,7 @@ impl<E: EthSpec> CandidateBeaconNode<E> {
Err(e) => { Err(e) => {
// Set the health as `Err` which is sorted last in the list. // Set the health as `Err` which is sorted last in the list.
*self.health.write() = Err(e); *self.health.write() = Err(e);
Ok(()) Err(e)
} }
} }
} else { } else {
@@ -402,8 +402,9 @@ impl<T: SlotClock, E: EthSpec> BeaconNodeFallback<T, E> {
pub async fn num_available(&self) -> usize { pub async fn num_available(&self) -> usize {
let mut n = 0; let mut n = 0;
for candidate in self.candidates.read().await.iter() { for candidate in self.candidates.read().await.iter() {
if candidate.health().is_ok() { match candidate.health() {
n += 1 Ok(_) | Err(CandidateError::Uninitialized) => n += 1,
Err(_) => continue,
} }
} }
n n

View File

@@ -96,7 +96,7 @@ async fn notify<T: SlotClock + 'static, E: EthSpec>(
"head_slot" => %health.head, "head_slot" => %health.head,
"is_optimistic" => ?health.optimistic_status, "is_optimistic" => ?health.optimistic_status,
"execution_engine_status" => ?health.execution_status, "execution_engine_status" => ?health.execution_status,
"health_tier" => ?health.health_tier, "health_tier" => %health.health_tier,
); );
} else { } else {
debug!( debug!(