Merge fix/pd-mem-leak

This commit is contained in:
Timothy Pogue
2022-11-17 16:21:12 -07:00
22 changed files with 201 additions and 71 deletions

View File

@@ -76,13 +76,14 @@ class WebSocketChannel:
Close the WebSocketChannel
"""
self._closed.set()
self._relay_task.cancel()
try:
await self._websocket.close()
except Exception:
pass
self._closed.set()
def is_closed(self) -> bool:
"""
Closed flag

View File

@@ -4,7 +4,7 @@ from typing import Any, Dict, Union
import orjson
import rapidjson
from pandas import DataFrame
from pandas import DataFrame, Timestamp
from freqtrade.misc import dataframe_to_json, json_to_dataframe
from freqtrade.rpc.api_server.ws.proxy import WebSocketProxy
@@ -51,6 +51,11 @@ def _json_default(z):
'__type__': 'dataframe',
'__value__': dataframe_to_json(z)
}
# Pandas returns a Timestamp object, we need to
# convert it to a timestamp int (with ms) for orjson
# to handle it
if isinstance(z, Timestamp):
return z.timestamp() * 1e3
raise TypeError