Improve logging and handling when websocket gets behind (#86854)

fixes undefined
This commit is contained in:
J. Nick Koston
2023-01-29 10:49:27 -10:00
committed by GitHub
parent c612a92cfb
commit 0f4b17755e
7 changed files with 127 additions and 36 deletions

View File

@@ -0,0 +1,13 @@
"""Websocket API util.""."""
from __future__ import annotations
from aiohttp import web
def describe_request(request: web.Request) -> str:
"""Describe a request."""
description = f"from {request.remote}"
if user_agent := request.headers.get("user-agent"):
description += f" ({user_agent})"
return description