update_manager: send a "update_refreshed" notification after init
The Klipper repo always initializes last. Send a notification at this time, so if any clients are connected they can receive the full update status after init. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
e489b795e6
commit
daad55640b
|
@ -144,9 +144,19 @@ class UpdateManager:
|
||||||
# Current Klipper Updater is valid
|
# Current Klipper Updater is valid
|
||||||
return
|
return
|
||||||
kcfg = self.config[f"update_manager static {self.distro} klipper"]
|
kcfg = self.config[f"update_manager static {self.distro} klipper"]
|
||||||
|
need_notification = "klipper" not in self.updaters
|
||||||
self.updaters['klipper'] = GitUpdater(kcfg, self.cmd_helper, kpath, env)
|
self.updaters['klipper'] = GitUpdater(kcfg, self.cmd_helper, kpath, env)
|
||||||
async with self.cmd_request_lock:
|
async with self.cmd_request_lock:
|
||||||
await self.updaters['klipper'].refresh()
|
await self.updaters['klipper'].refresh()
|
||||||
|
if need_notification:
|
||||||
|
vinfo = {}
|
||||||
|
for name, updater in self.updaters.items():
|
||||||
|
if hasattr(updater, "get_update_status"):
|
||||||
|
vinfo[name] = updater.get_update_status()
|
||||||
|
uinfo = self.cmd_helper.get_rate_limit_stats()
|
||||||
|
uinfo['version_info'] = vinfo
|
||||||
|
uinfo['busy'] = self.cmd_helper.is_update_busy()
|
||||||
|
self.server.send_event("update_manager:update_refreshed", uinfo)
|
||||||
|
|
||||||
async def _check_klippy_printing(self):
|
async def _check_klippy_printing(self):
|
||||||
klippy_apis = self.server.lookup_component('klippy_apis')
|
klippy_apis = self.server.lookup_component('klippy_apis')
|
||||||
|
|
Loading…
Reference in New Issue