Fix non-terminating bot

This commit is contained in:
Matthias 2019-11-15 20:10:17 +01:00
parent 1d18e0a11a
commit edc0d7f2c7
2 changed files with 9 additions and 5 deletions

View File

@ -27,7 +27,6 @@ def main(sysargv: List[str] = None) -> None:
""" """
return_code: Any = 1 return_code: Any = 1
worker = None
try: try:
arguments = Arguments(sysargv) arguments = Arguments(sysargv)
args = arguments.get_parsed_arg() args = arguments.get_parsed_arg()
@ -57,8 +56,6 @@ def main(sysargv: List[str] = None) -> None:
except Exception: except Exception:
logger.exception('Fatal exception!') logger.exception('Fatal exception!')
finally: finally:
if worker:
worker.exit()
sys.exit(return_code) sys.exit(return_code)

View File

@ -45,8 +45,15 @@ def start_trading(args: Dict[str, Any]) -> int:
""" """
from freqtrade.worker import Worker from freqtrade.worker import Worker
# Load and run worker # Load and run worker
try:
worker = Worker(args) worker = Worker(args)
worker.run() worker.run()
except KeyboardInterrupt:
logger.info('SIGINT received, aborting ...')
finally:
if worker:
logger.info("worker found ... calling exit")
worker.exit()
return 0 return 0