update_manager: Use the "klippy_identified" event to update Klippy paths

Only update the Klipper Repo Object if the paths have changed.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2020-12-30 11:54:23 -05:00
parent 8fc5aab2f0
commit 2953c3f16f
1 changed files with 6 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class UpdateManager:
# Register Ready Event
self.server.register_event_handler(
"server:klippy_ready", self._set_klipper_repo)
"server:klippy_identified", self._set_klipper_repo)
# Initialize GitHub API Rate Limits
IOLoop.current().spawn_callback(self._init_api_rate_limit)
@ -103,6 +103,11 @@ class UpdateManager:
return
kpath = kinfo['klipper_path']
env = kinfo['python_path']
kupdater = self.updaters.get('klipper', None)
if kupdater is not None and kupdater.repo_path == kpath and \
kupdater.env == env:
# Current Klipper Updater is valid
return
self.updaters['klipper'] = GitUpdater(self, "klipper", kpath, env)
async def _handle_update_request(self, web_request):