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

View File

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