refactor(config): use pydantic-settings

This commit is contained in:
MingxuanGame
2025-08-10 05:38:28 +00:00
parent 703a7901b3
commit f165ae5dc3
12 changed files with 105 additions and 59 deletions

View File

@@ -74,7 +74,7 @@ class Client:
while True:
try:
await self.send_packet(PingPacket())
await asyncio.sleep(settings.SIGNALR_PING_INTERVAL)
await asyncio.sleep(settings.signalr_ping_interval)
except WebSocketDisconnect:
break
except Exception as e:
@@ -131,7 +131,7 @@ class Hub[TState: UserState]:
if connection_token in self.waited_clients:
if (
self.waited_clients[connection_token]
< time.time() - settings.SIGNALR_NEGOTIATE_TIMEOUT
< time.time() - settings.signalr_negotiate_timeout
):
raise TimeoutError(f"Connection {connection_id} has waited too long.")
del self.waited_clients[connection_token]