reload_conf & reload_config now both accepted, code is more consistent now

This commit is contained in:
Theagainmen
2020-06-09 23:03:55 +02:00
committed by Matthias
parent 9380cf484a
commit ac92834693
13 changed files with 40 additions and 37 deletions

View File

@@ -172,8 +172,8 @@ class ApiServer(RPC):
self.app.add_url_rule(f'{BASE_URI}/stop', 'stop', view_func=self._stop, methods=['POST'])
self.app.add_url_rule(f'{BASE_URI}/stopbuy', 'stopbuy',
view_func=self._stopbuy, methods=['POST'])
self.app.add_url_rule(f'{BASE_URI}/reload_conf', 'reload_conf',
view_func=self._reload_conf, methods=['POST'])
self.app.add_url_rule(f'{BASE_URI}/reload_config', 'reload_config',
view_func=self._reload_config, methods=['POST'])
# Info commands
self.app.add_url_rule(f'{BASE_URI}/balance', 'balance',
view_func=self._balance, methods=['GET'])
@@ -304,12 +304,12 @@ class ApiServer(RPC):
@require_login
@rpc_catch_errors
def _reload_conf(self):
def _reload_config(self):
"""
Handler for /reload_conf.
Handler for /reload_config.
Triggers a config file reload
"""
msg = self._rpc_reload_conf()
msg = self._rpc_reload_config()
return self.rest_dump(msg)
@require_login

View File

@@ -418,9 +418,9 @@ class RPC:
return {'status': 'already stopped'}
def _rpc_reload_conf(self) -> Dict[str, str]:
""" Handler for reload_conf. """
self._freqtrade.state = State.RELOAD_CONF
def _rpc_reload_config(self) -> Dict[str, str]:
""" Handler for reload_config. """
self._freqtrade.state = State.RELOAD_CONFIG
return {'status': 'reloading config ...'}
def _rpc_stopbuy(self) -> Dict[str, str]:
@@ -431,7 +431,7 @@ class RPC:
# Set 'max_open_trades' to 0
self._freqtrade.config['max_open_trades'] = 0
return {'status': 'No more buy will occur from now. Run /reload_conf to reset.'}
return {'status': 'No more buy will occur from now. Run /reload_config to reset.'}
def _rpc_forcesell(self, trade_id: str) -> Dict[str, str]:
"""

View File

@@ -95,7 +95,9 @@ class Telegram(RPC):
CommandHandler('performance', self._performance),
CommandHandler('daily', self._daily),
CommandHandler('count', self._count),
CommandHandler('reload_conf', self._reload_conf),
CommandHandler('reload_conf', self._reload_config),
CommandHandler('reload_config', self._reload_config),
CommandHandler('show_conf', self._reload_config),
CommandHandler('show_config', self._show_config),
CommandHandler('stopbuy', self._stopbuy),
CommandHandler('whitelist', self._whitelist),
@@ -436,15 +438,15 @@ class Telegram(RPC):
self._send_msg('Status: `{status}`'.format(**msg))
@authorized_only
def _reload_conf(self, update: Update, context: CallbackContext) -> None:
def _reload_config(self, update: Update, context: CallbackContext) -> None:
"""
Handler for /reload_conf.
Handler for /reload_config.
Triggers a config file reload
:param bot: telegram bot
:param update: message update
:return: None
"""
msg = self._rpc_reload_conf()
msg = self._rpc_reload_config()
self._send_msg('Status: `{status}`'.format(**msg))
@authorized_only
@@ -617,7 +619,7 @@ class Telegram(RPC):
"\n"
"*/balance:* `Show account balance per currency`\n"
"*/stopbuy:* `Stops buying, but handles open trades gracefully` \n"
"*/reload_conf:* `Reload configuration file` \n"
"*/reload_config:* `Reload configuration file` \n"
"*/show_config:* `Show running configuration` \n"
"*/whitelist:* `Show current whitelist` \n"
"*/blacklist [pair]:* `Show current blacklist, or adds one or more pairs "

View File

@@ -12,7 +12,7 @@ class State(Enum):
"""
RUNNING = 1
STOPPED = 2
RELOAD_CONF = 3
RELOAD_CONFIG = 3
def __str__(self):
return f"{self.name.lower()}"

View File

@@ -71,7 +71,7 @@ class Worker:
state = None
while True:
state = self._worker(old_state=state)
if state == State.RELOAD_CONF:
if state == State.RELOAD_CONFIG:
self._reconfigure()
def _worker(self, old_state: Optional[State]) -> State: