fix: Graceful shutdown in case of failed initialization
This commit is contained in:
@@ -92,7 +92,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
exchange_config: ExchangeConfig = deepcopy(config["exchange"])
|
exchange_config: ExchangeConfig = deepcopy(config["exchange"])
|
||||||
# Remove credentials from original exchange config to avoid accidental credential exposure
|
# Remove credentials from original exchange config to avoid accidental credential exposure
|
||||||
remove_exchange_credentials(config["exchange"], True)
|
remove_exchange_credentials(config["exchange"], True)
|
||||||
|
try:
|
||||||
self.exchange = ExchangeResolver.load_exchange(
|
self.exchange = ExchangeResolver.load_exchange(
|
||||||
self.config, exchange_config=exchange_config, load_leverage_tiers=True
|
self.config, exchange_config=exchange_config, load_leverage_tiers=True
|
||||||
)
|
)
|
||||||
@@ -187,6 +187,11 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
|
|
||||||
self._measure_execution = MeasureTime(log_took_too_long, timeframe_secs * 0.25)
|
self._measure_execution = MeasureTime(log_took_too_long, timeframe_secs * 0.25)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# Graceful shutdown in case of failed initialization.
|
||||||
|
self.cleanup()
|
||||||
|
raise e from e
|
||||||
|
|
||||||
def notify_status(self, msg: str, msg_type=RPCMessageType.STATUS) -> None:
|
def notify_status(self, msg: str, msg_type=RPCMessageType.STATUS) -> None:
|
||||||
"""
|
"""
|
||||||
Public method for users of this class (worker, etc.) to send notifications
|
Public method for users of this class (worker, etc.) to send notifications
|
||||||
|
|||||||
Reference in New Issue
Block a user