fix(host_aggregator): total=1 時 total//2=0 導致服務全 up 仍顯示 unhealthy
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
112(Kali) 和 120(K3s) 各只有 1 個服務,down_count=0 >= total//2=0 永遠成立 → 永遠 unhealthy。改為 total > 1 才套用 >=half 門檻。 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -391,9 +391,10 @@ class HostAggregator:
|
||||
degraded_count = sum(1 for s in services if s.status == "degraded")
|
||||
total = len(services)
|
||||
|
||||
# 2026-04-09 Claude Sonnet 4.6: 修正 total=1 時 total//2=0 導致永遠 unhealthy
|
||||
if down_count == total:
|
||||
host_status: Literal["healthy", "degraded", "unhealthy", "unreachable"] = "unreachable"
|
||||
elif down_count >= total // 2:
|
||||
elif total > 1 and down_count >= total // 2:
|
||||
host_status = "unhealthy"
|
||||
elif down_count > 0 or degraded_count > 0:
|
||||
host_status = "degraded"
|
||||
|
||||
Reference in New Issue
Block a user