Better handle random UI backtest errors

This commit is contained in:
Matthias 2023-02-22 07:06:59 +01:00
parent e56bf067c4
commit ff1258fd20

View File

@ -10,7 +10,7 @@ from fastapi.exceptions import HTTPException
from freqtrade.configuration.config_validation import validate_config_consistency from freqtrade.configuration.config_validation import validate_config_consistency
from freqtrade.data.btanalysis import get_backtest_resultlist, load_and_merge_backtest_result from freqtrade.data.btanalysis import get_backtest_resultlist, load_and_merge_backtest_result
from freqtrade.enums import BacktestState from freqtrade.enums import BacktestState
from freqtrade.exceptions import DependencyException from freqtrade.exceptions import DependencyException, OperationalException
from freqtrade.misc import deep_merge_dicts from freqtrade.misc import deep_merge_dicts
from freqtrade.rpc.api_server.api_schemas import (BacktestHistoryEntry, BacktestRequest, from freqtrade.rpc.api_server.api_schemas import (BacktestHistoryEntry, BacktestRequest,
BacktestResponse) BacktestResponse)
@ -117,8 +117,8 @@ async def api_start_backtest(bt_settings: BacktestRequest, background_tasks: Bac
logger.info("Backtest finished.") logger.info("Backtest finished.")
except DependencyException as e: except (OperationalException, DependencyException) as e:
logger.info(f"Backtesting caused an error: {e}") logger.exception(f"Backtesting caused an error: {e}")
pass pass
finally: finally:
ApiServer._bgtask_running = False ApiServer._bgtask_running = False