Fix non-terminating bot
This commit is contained in:
parent
1d18e0a11a
commit
edc0d7f2c7
@ -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)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user