From 8d813fa728a4d454aaa8cf95a84e507513ca5aa6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 13 Aug 2019 09:36:52 +0200 Subject: [PATCH] Remove return-value for _process --- freqtrade/tests/test_freqtradebot.py | 15 +++++++-------- freqtrade/worker.py | 9 ++------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/freqtrade/tests/test_freqtradebot.py b/freqtrade/tests/test_freqtradebot.py index 4e649250a..883e4f050 100644 --- a/freqtrade/tests/test_freqtradebot.py +++ b/freqtrade/tests/test_freqtradebot.py @@ -744,8 +744,7 @@ def test_process_exchange_failures(default_conf, ticker, markets, mocker) -> Non worker = Worker(args=None, config=default_conf) patch_get_signal(worker.freqtrade) - result = worker._process() - assert result is False + worker._process() assert sleep_mock.has_calls() @@ -763,8 +762,7 @@ def test_process_operational_exception(default_conf, ticker, markets, mocker) -> assert worker.state == State.RUNNING - result = worker._process() - assert result is False + worker._process() assert worker.state == State.STOPPED assert 'OperationalException' in msg_mock.call_args_list[-1][0][0]['status'] @@ -786,13 +784,14 @@ def test_process_trade_handling( trades = Trade.query.filter(Trade.is_open.is_(True)).all() assert not trades - result = freqtrade.process() - assert result is True + freqtrade.process() + trades = Trade.query.filter(Trade.is_open.is_(True)).all() assert len(trades) == 1 - result = freqtrade.process() - assert result is False + # Nothing happened ... + freqtrade.process() + assert len(trades) == 1 def test_process_trade_no_whitelist_pair( diff --git a/freqtrade/worker.py b/freqtrade/worker.py index db0dba0e8..df792e35e 100755 --- a/freqtrade/worker.py +++ b/freqtrade/worker.py @@ -127,11 +127,10 @@ class Worker(object): time.sleep(duration) return result - def _process(self) -> bool: + def _process(self) -> None: logger.debug("========================================") - state_changed = False try: - state_changed = self.freqtrade.process() + self.freqtrade.process() except TemporaryError as error: logger.warning(f"Error: {error}, retrying in {constants.RETRY_TIMEOUT} seconds...") time.sleep(constants.RETRY_TIMEOUT) @@ -144,10 +143,6 @@ class Worker(object): }) logger.exception('OperationalException. Stopping trader ...') self.freqtrade.state = State.STOPPED - # TODO: The return value of _process() is not used apart tests - # and should (could) be eliminated later. See PR #1689. -# state_changed = True - return state_changed def _reconfigure(self) -> None: """