Fix potential race conditions between RPC and Freqtradebot during initialization
This commit is contained in:
parent
470efd6f40
commit
2e1e080022
@ -55,8 +55,6 @@ class FreqtradeBot:
|
||||
# Check config consistency here since strategies can set certain options
|
||||
validate_config_consistency(config)
|
||||
|
||||
self.rpc: RPCManager = RPCManager(self)
|
||||
|
||||
self.exchange = ExchangeResolver(self.config['exchange']['name'], self.config).exchange
|
||||
|
||||
self.wallets = Wallets(self.config, self.exchange)
|
||||
@ -83,6 +81,13 @@ class FreqtradeBot:
|
||||
initial_state = self.config.get('initial_state')
|
||||
self.state = State[initial_state.upper()] if initial_state else State.STOPPED
|
||||
|
||||
# RPC runs in separate threads, can start handling external commands just after
|
||||
# initialization, even before Freqtradebot has a chance to start its throttling,
|
||||
# so anything in the Freqtradebot instance should be ready (initialized), including
|
||||
# the initial state of the bot.
|
||||
# Keep this at the end of this initialization method.
|
||||
self.rpc: RPCManager = RPCManager(self)
|
||||
|
||||
def cleanup(self) -> None:
|
||||
"""
|
||||
Cleanup pending resources on an already stopped bot
|
||||
|
Loading…
Reference in New Issue
Block a user