修复睡眠时期出现安装超时退出的问题

This commit is contained in:
wangsong 2022-10-25 15:11:16 +08:00
parent 1d3a330b7a
commit c3d59639dc
2 changed files with 12 additions and 11 deletions

View File

@ -1048,7 +1048,7 @@ class UpdateInstallMode():
'org.freedesktop.login1', '/org/freedesktop/login1',
'org.freedesktop.login1.Manager', 'Inhibit',
GLib.Variant('(ssss)',
('shutdown:sleep',
('shutdown',
'Kylin System Updater', 'Updating System',
'delay')),
None, 0, -1, None, None)

View File

@ -24,8 +24,8 @@ from importlib import reload
# 超时检测 秒单位
UPDATER_IDLE_CHECK_INTERVAL = 5
#安装的超时检查20分钟
INSTALL_IDLE_TIMEOUT = 20 * 60
#安装的超时检查20分钟 按照5秒检查一次
INSTALL_IDLE_TIMEOUT = 4 * 60
#更新超时检查 5分钟
UPDATE_IDLE_TIMEOUT = 5 * 60
@ -63,7 +63,7 @@ class InstallBackendAptdaemon(InstallBackend):
elif self.action == self.ACTION_INSTALL or self.action == self.ACTION_INSTALL_SHUTDOWN:
#安装的超时间检查 超时解除禁止关机
self.install_timestamp = time.time()
self.install_timestamp = INSTALL_IDLE_TIMEOUT
self.check_progress = 0
GLib.timeout_add_seconds(UPDATER_IDLE_CHECK_INTERVAL,
self._check_install_inactivity)
@ -81,20 +81,19 @@ class InstallBackendAptdaemon(InstallBackend):
"""Shutdown the daemon if it has been inactive for time specified
in INSTALL_IDLE_TIMEOUT.
"""
logging.info("Checking for inactivity in Installing...")
logging.info("Checking for inactivity in Installing Time:%d...",self.install_timestamp)
if self.window_main.now_working != self.ACTION_INSTALL and self.window_main.now_working != self.ACTION_INSTALL_SHUTDOWN:
logging.info("Installing to exit and timeout check quit...")
return False
#进度不同时 更新时间戳
# 进度不同时 更新时间戳
if self.aptd_base.progress != self.check_progress:
self.check_progress = self.aptd_base.progress
self.install_timestamp = time.time()
self.install_timestamp = INSTALL_IDLE_TIMEOUT
#只有安装的时候启用 下载时候不使用
timestamp = self.install_timestamp
if (time.time() - timestamp > INSTALL_IDLE_TIMEOUT
and self.on_install_stage == True):
if (self.install_timestamp <= 0 and self.on_install_stage == True):
logging.error("Quitting due to inactivity(%s)",self.aptd_base.details)
if self.action == self.ACTION_INSTALL_SHUTDOWN:
#关机安装模式 解除禁止关机锁
@ -111,8 +110,10 @@ class InstallBackendAptdaemon(InstallBackend):
# self.window_main.dbusController.Quit(None)
return False
return True
else:
self.install_timestamp = self.install_timestamp - 1
return True
def _check_update_inactivity(self):
logging.info("Checking for inactivity in Updating...")