update_manager: resolve initialization issues
Fix issue where apt-get update is called on startup. This should only be done by the "auto updater" or by a specific request to refresh. Always set an Updater's init event to true when refresh() is called, regardless of the result. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
25b3911d3d
commit
ddc7405249
|
@ -127,7 +127,7 @@ class UpdateManager:
|
|||
else:
|
||||
ret = updater.refresh()
|
||||
if asyncio.iscoroutine(ret):
|
||||
await updater.refresh()
|
||||
await ret
|
||||
self.is_refreshing = False
|
||||
|
||||
async def _set_klipper_repo(self):
|
||||
|
@ -515,7 +515,6 @@ class GitUpdater:
|
|||
await self._check_version()
|
||||
except Exception:
|
||||
logging.exception("Error Refreshing git state")
|
||||
else:
|
||||
self.init_evt.set()
|
||||
self.refresh_condition.notify_all()
|
||||
self.refresh_condition = None
|
||||
|
@ -781,9 +780,10 @@ class PackageUpdater:
|
|||
return
|
||||
try:
|
||||
if fetch_packages:
|
||||
await self.execute_cmd(f"{APT_CMD} update", timeout=300.)
|
||||
await self.execute_cmd(
|
||||
f"{APT_CMD} update", timeout=300., retries=3)
|
||||
res = await self.execute_cmd_with_response(
|
||||
"apt list --upgradable")
|
||||
"apt list --upgradable", timeout=60.)
|
||||
pkg_list = [p.strip() for p in res.split("\n") if p.strip()]
|
||||
if pkg_list:
|
||||
pkg_list = pkg_list[2:]
|
||||
|
@ -795,7 +795,6 @@ class PackageUpdater:
|
|||
f"\n{pkg_list}")
|
||||
except Exception:
|
||||
logging.exception("Error Refreshing System Packages")
|
||||
else:
|
||||
self.init_evt.set()
|
||||
self.refresh_condition.notify_all()
|
||||
self.refresh_condition = None
|
||||
|
@ -874,7 +873,6 @@ class WebUpdater:
|
|||
await self._get_remote_version()
|
||||
except Exception:
|
||||
logging.exception("Error Refreshing Client")
|
||||
else:
|
||||
self.init_evt.set()
|
||||
self.refresh_condition.notify_all()
|
||||
self.refresh_condition = None
|
||||
|
|
Loading…
Reference in New Issue