From 8dc159e9d2ae523715e822c4c90c710db37b9681 Mon Sep 17 00:00:00 2001 From: skelmis Date: Wed, 13 Mar 2024 23:02:46 +1300 Subject: [PATCH] fix: some garven errors --- garven/routers/aggregate.py | 7 +++++++ garven/routers/cluster.py | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/garven/routers/aggregate.py b/garven/routers/aggregate.py index 58b7ea0..9997a5e 100644 --- a/garven/routers/aggregate.py +++ b/garven/routers/aggregate.py @@ -54,6 +54,13 @@ async def guild_count(request: Request): log.error("/guilds/count WS threw '%s'", item.response_data) continue + if item is None: + statistic.partial_response = True + log.error( + "/guilds/count gave a null item", + ) + continue + statistic.statistic += item cluster_count = int(os.environ.get("CLUSTER_COUNT", 11)) diff --git a/garven/routers/cluster.py b/garven/routers/cluster.py index 563fa1a..2b8f547 100644 --- a/garven/routers/cluster.py +++ b/garven/routers/cluster.py @@ -52,10 +52,15 @@ async def cluster_status(request: Request): z: Server = request.app.zonis d: dict[str, dict[str, str]] = await z.request_all("cluster_ws_status") shard_data = {} - for _, item in deepcopy(d).items(): + for c, item in deepcopy(d).items(): if isinstance(item, RequestFailed): partial_response = True - log.error("/cluster/status/ws WS threw '%s'", item.response_data) + log.error("/cluster/latency/ws WS threw '%s'", item.response_data) + continue + + if item is None: + partial_response = True + log.error("/cluster/latency/ws had a null value from %s", c) continue for shard_id, value in item.items():