Run webserver in main thread when using webserver mode
This commit is contained in:
parent
37b15e830a
commit
03140a0ecb
@ -339,14 +339,14 @@ def api_get_backtest():
|
||||
Get backtesting result.
|
||||
Returns Result after backtesting has been ran.
|
||||
"""
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.persistence import LocalTrade
|
||||
if ApiServer._bgtask_running:
|
||||
return {
|
||||
"status": "running",
|
||||
"running": True,
|
||||
"step": ApiServer._bt.get_action() if ApiServer._bt else str(BacktestState.STARTUP),
|
||||
"progress": ApiServer._bt.get_progress() if ApiServer._bt else 0,
|
||||
"trade_count": Trade.get_trades_proxy(is_open=False),
|
||||
"trade_count": len(LocalTrade.trades),
|
||||
"status_msg": "Backtest running",
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,9 @@ class ApiServer(RPCHandler):
|
||||
)
|
||||
try:
|
||||
self._server = UvicornServer(uvconfig)
|
||||
if self._standalone:
|
||||
self._server.run()
|
||||
else:
|
||||
self._server.run_in_thread()
|
||||
except Exception:
|
||||
logger.exception("Api server failed to start.")
|
||||
|
Loading…
Reference in New Issue
Block a user