fix tests, log unknown errors

This commit is contained in:
Timothy Pogue
2022-11-21 12:21:40 -07:00
parent d2870d48ea
commit d9d7df70bf
3 changed files with 29 additions and 20 deletions

View File

@@ -212,7 +212,6 @@ class ApiServer(RPCHandler):
if self._standalone:
self._server.run()
else:
# self.start_message_queue()
self._server.run_in_thread()
except Exception:
logger.exception("Api server failed to start.")

View File

@@ -6,6 +6,9 @@ from contextlib import asynccontextmanager
from typing import Any, AsyncIterator, Deque, Dict, List, Optional, Type, Union
from uuid import uuid4
from fastapi import WebSocketDisconnect
from websockets.exceptions import ConnectionClosed
from freqtrade.rpc.api_server.ws.proxy import WebSocketProxy
from freqtrade.rpc.api_server.ws.serializer import (HybridJSONWebSocketSerializer,
WebSocketSerializer)
@@ -189,7 +192,16 @@ class WebSocketChannel:
task.cancel()
# Wait for tasks to finish cancelling
await asyncio.wait(self._channel_tasks)
try:
await task
except (
asyncio.CancelledError,
WebSocketDisconnect,
ConnectionClosed
):
pass
except Exception as e:
logger.info(f"Encountered unknown exception: {e}", exc_info=e)
self._channel_tasks = []