fix: improve bot cleanup methods for safer shutdown

This commit is contained in:
Matthias
2026-04-06 09:26:08 +02:00
parent e6aa098c4e
commit 04990a888b
+2
View File
@@ -216,6 +216,7 @@ class FreqtradeBot(LoggingMixin):
logger.warning(f"Exception during cleanup: {e.__class__.__name__} {e}")
finally:
if getattr(self, "strategy", None):
self.strategy.ft_bot_cleanup()
if getattr(self, "rpc", None):
@@ -225,6 +226,7 @@ class FreqtradeBot(LoggingMixin):
if getattr(self, "exchange", None):
self.exchange.close()
try:
if hasattr(Trade, "session"):
Trade.commit()
except Exception:
# Exceptions here will be happening if the db disappeared.