fix: improve bot cleanup methods for safer shutdown
This commit is contained in:
@@ -216,7 +216,8 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
logger.warning(f"Exception during cleanup: {e.__class__.__name__} {e}")
|
logger.warning(f"Exception during cleanup: {e.__class__.__name__} {e}")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.strategy.ft_bot_cleanup()
|
if getattr(self, "strategy", None):
|
||||||
|
self.strategy.ft_bot_cleanup()
|
||||||
|
|
||||||
if getattr(self, "rpc", None):
|
if getattr(self, "rpc", None):
|
||||||
self.rpc.cleanup()
|
self.rpc.cleanup()
|
||||||
@@ -225,7 +226,8 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
if getattr(self, "exchange", None):
|
if getattr(self, "exchange", None):
|
||||||
self.exchange.close()
|
self.exchange.close()
|
||||||
try:
|
try:
|
||||||
Trade.commit()
|
if hasattr(Trade, "session"):
|
||||||
|
Trade.commit()
|
||||||
except Exception:
|
except Exception:
|
||||||
# Exceptions here will be happening if the db disappeared.
|
# Exceptions here will be happening if the db disappeared.
|
||||||
# At which point we can no longer commit anyway.
|
# At which point we can no longer commit anyway.
|
||||||
|
|||||||
Reference in New Issue
Block a user