Remove return-value for _process

This commit is contained in:
Matthias 2019-08-13 09:36:52 +02:00
parent 8c1efec43a
commit 8d813fa728
2 changed files with 9 additions and 15 deletions

View File

@ -744,8 +744,7 @@ def test_process_exchange_failures(default_conf, ticker, markets, mocker) -> Non
worker = Worker(args=None, config=default_conf) worker = Worker(args=None, config=default_conf)
patch_get_signal(worker.freqtrade) patch_get_signal(worker.freqtrade)
result = worker._process() worker._process()
assert result is False
assert sleep_mock.has_calls() assert sleep_mock.has_calls()
@ -763,8 +762,7 @@ def test_process_operational_exception(default_conf, ticker, markets, mocker) ->
assert worker.state == State.RUNNING assert worker.state == State.RUNNING
result = worker._process() worker._process()
assert result is False
assert worker.state == State.STOPPED assert worker.state == State.STOPPED
assert 'OperationalException' in msg_mock.call_args_list[-1][0][0]['status'] 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() trades = Trade.query.filter(Trade.is_open.is_(True)).all()
assert not trades assert not trades
result = freqtrade.process() freqtrade.process()
assert result is True
trades = Trade.query.filter(Trade.is_open.is_(True)).all() trades = Trade.query.filter(Trade.is_open.is_(True)).all()
assert len(trades) == 1 assert len(trades) == 1
result = freqtrade.process() # Nothing happened ...
assert result is False freqtrade.process()
assert len(trades) == 1
def test_process_trade_no_whitelist_pair( def test_process_trade_no_whitelist_pair(

View File

@ -127,11 +127,10 @@ class Worker(object):
time.sleep(duration) time.sleep(duration)
return result return result
def _process(self) -> bool: def _process(self) -> None:
logger.debug("========================================") logger.debug("========================================")
state_changed = False
try: try:
state_changed = self.freqtrade.process() self.freqtrade.process()
except TemporaryError as error: except TemporaryError as error:
logger.warning(f"Error: {error}, retrying in {constants.RETRY_TIMEOUT} seconds...") logger.warning(f"Error: {error}, retrying in {constants.RETRY_TIMEOUT} seconds...")
time.sleep(constants.RETRY_TIMEOUT) time.sleep(constants.RETRY_TIMEOUT)
@ -144,10 +143,6 @@ class Worker(object):
}) })
logger.exception('OperationalException. Stopping trader ...') logger.exception('OperationalException. Stopping trader ...')
self.freqtrade.state = State.STOPPED 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: def _reconfigure(self) -> None:
""" """