Skip to content

Commit

Permalink
fix(cluster): health record was updated (#147)
Browse files Browse the repository at this point in the history
* fix(cluster): health record was updated

fixes:  #136

* fix(client): forgot it was a dict now
  • Loading branch information
fubuloubu authored Oct 21, 2024
1 parent bfba34b commit 9b3a5b4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions silverback/cluster/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,10 @@ class ServiceHealth(BaseModel):


class ClusterHealth(BaseModel):
ars: ServiceHealth = Field(exclude=True) # TODO: Replace w/ cluster
ccs: ServiceHealth = Field(exclude=True) # TODO: Replace w/ cluster
# TODO: Replace w/ cluster
ccs: ServiceHealth
# NOTE: network => healthy
ars: dict[str, ServiceHealth] = {}
bots: dict[str, ServiceHealth] = {}

@field_validator("bots", mode="before") # TODO: Fix so this is default
Expand All @@ -317,7 +319,9 @@ def convert_bot_health(cls, bots):

@computed_field
def cluster(self) -> ServiceHealth:
return ServiceHealth(healthy=self.ars.healthy and self.ccs.healthy)
return ServiceHealth(
healthy=all(ars.healthy for ars in self.ars.values()) and self.ccs.healthy
)


class RegistryCredentialsInfo(BaseModel):
Expand Down

0 comments on commit 9b3a5b4

Please sign in to comment.