This commit is contained in:
Matthias 2019-10-26 09:21:51 +02:00
parent 2f1d9696cd
commit 3929ad4e1f
2 changed files with 5 additions and 5 deletions

View File

@ -53,7 +53,7 @@ class FreqtradeBot:
self._heartbeat_msg = 0 self._heartbeat_msg = 0
self.hearbeat_interval = self.config.get('internals', {}).get('heartbeat_interval', 60) self.heartbeat_interval = self.config.get('internals', {}).get('heartbeat_interval', 60)
self.strategy: IStrategy = StrategyResolver(self.config).strategy self.strategy: IStrategy = StrategyResolver(self.config).strategy
@ -155,9 +155,9 @@ class FreqtradeBot:
self.check_handle_timedout() self.check_handle_timedout()
Trade.session.flush() Trade.session.flush()
if (self.hearbeat_interval if (self.heartbeat_interval
and (arrow.utcnow().timestamp - self._heartbeat_msg > self.hearbeat_interval)): and (arrow.utcnow().timestamp - self._heartbeat_msg > self.heartbeat_interval)):
logger.info(f"Freqtrade heartbeat. PID={getpid()}") logger.info(f"Bot heartbeat. PID={getpid()}")
self._heartbeat_msg = arrow.utcnow().timestamp self._heartbeat_msg = arrow.utcnow().timestamp
def _extend_whitelist_with_trades(self, whitelist: List[str], trades: List[Any]): def _extend_whitelist_with_trades(self, whitelist: List[str], trades: List[Any]):

View File

@ -3656,7 +3656,7 @@ def test_process_i_am_alive(default_conf, mocker, caplog):
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True)) mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
ftbot = get_patched_freqtradebot(mocker, default_conf) ftbot = get_patched_freqtradebot(mocker, default_conf)
message = r"Freqtrade heartbeat. PID=.*" message = r"Bot heartbeat\. PID=.*"
ftbot.process() ftbot.process()
assert log_has_re(message, caplog) assert log_has_re(message, caplog)
assert ftbot._heartbeat_msg != 0 assert ftbot._heartbeat_msg != 0