From 537c03504f62c5f59a59fd11b912470ae58a4e96 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Tue, 30 Apr 2019 10:29:49 +0300 Subject: [PATCH 1/2] fix #1810 --- freqtrade/worker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freqtrade/worker.py b/freqtrade/worker.py index c7afe5c97..60c069e11 100755 --- a/freqtrade/worker.py +++ b/freqtrade/worker.py @@ -71,7 +71,7 @@ class Worker(object): while True: state = self._worker(old_state=state) if state == State.RELOAD_CONF: - self.freqtrade = self._reconfigure() + self._reconfigure() def _worker(self, old_state: State, throttle_secs: Optional[float] = None) -> State: """ From 5665426e6ba752c29be6dd9230c91ab08c4046c5 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Tue, 30 Apr 2019 19:47:55 +0300 Subject: [PATCH 2/2] better type hints in worker --- freqtrade/worker.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/freqtrade/worker.py b/freqtrade/worker.py index 60c069e11..19a570505 100755 --- a/freqtrade/worker.py +++ b/freqtrade/worker.py @@ -39,7 +39,7 @@ class Worker(object): logger.debug("sd_notify: READY=1") self._sd_notify.notify("READY=1") - def _init(self, reconfig: bool): + def _init(self, reconfig: bool) -> None: """ Also called from the _reconfigure() method (with reconfig=True). """ @@ -63,17 +63,17 @@ class Worker(object): return self.freqtrade.state @state.setter - def state(self, value: State): + def state(self, value: State) -> None: self.freqtrade.state = value - def run(self): + def run(self) -> None: state = None while True: state = self._worker(old_state=state) if state == State.RELOAD_CONF: self._reconfigure() - def _worker(self, old_state: State, throttle_secs: Optional[float] = None) -> State: + def _worker(self, old_state: Optional[State], throttle_secs: Optional[float] = None) -> State: """ Trading routine that must be run at each loop :param old_state: the previous service state from the previous call @@ -148,7 +148,7 @@ class Worker(object): # state_changed = True return state_changed - def _reconfigure(self): + def _reconfigure(self) -> None: """ Cleans up current freqtradebot instance, reloads the configuration and replaces it with the new instance @@ -174,7 +174,7 @@ class Worker(object): logger.debug("sd_notify: READY=1") self._sd_notify.notify("READY=1") - def exit(self): + def exit(self) -> None: # Tell systemd that we are exiting now if self._sd_notify: logger.debug("sd_notify: STOPPING=1")