Add warning when queue websocket queue becomes too full

This commit is contained in:
Matthias 2022-11-18 14:03:56 +01:00
parent 436b314c80
commit 12cd83453c

View File

@ -194,6 +194,9 @@ class ApiServer(RPCHandler):
try: try:
while True: while True:
logger.debug("Getting queue messages...") logger.debug("Getting queue messages...")
if (qsize := async_queue.qsize()) > 20:
# If the queue becomes too big for too long, this may indicate a problem.
logger.warning(f"Queue size now {qsize}")
# Get data from queue # Get data from queue
message: WSMessageSchemaType = await async_queue.get() message: WSMessageSchemaType = await async_queue.get()
logger.debug(f"Found message of type: {message.get('type')}") logger.debug(f"Found message of type: {message.get('type')}")