Skip to content

Commit 89d9ad7

Browse files
committed
Gracefully handle infinite websocket latency
1 parent faa65da commit 89d9ad7

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and [Pydantic's HISTORY.md](https://github.com/pydantic/pydantic/blob/main/HISTORY.md), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## `0.5.4` - 2025-09-08
8+
9+
### Fixed
10+
11+
* Internal: gracefully handle infinite websocket latency.
12+
713
## `0.5.3` - 2025-09-03
814

915
### Fixed

bot/src/ghutils/cogs/api.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from __future__ import annotations
22

33
import logging
4+
import math
5+
import sys
46
from dataclasses import dataclass, field
57
from timeit import default_timer as timer
68
from typing import Annotated
@@ -70,10 +72,12 @@ async def get_health(
7072
except Exception as e:
7173
logger.error(f"Failed to make database request: {e.__class__.__name__}: {e}")
7274
response.status_code = HTTP_500_INTERNAL_SERVER_ERROR
73-
database_latency = float("inf")
75+
database_latency = sys.float_info.max
7476

7577
return HealthInfo(
76-
websocket_latency=bot.latency,
78+
websocket_latency=bot.latency
79+
if math.isfinite(bot.latency)
80+
else sys.float_info.max,
7781
database_latency=database_latency,
7882
)
7983

0 commit comments

Comments
 (0)