增加关机安装超时退出机制 超时时间20分钟
This commit is contained in:
parent
f4ae4d2c09
commit
68753a9115
|
@ -137,7 +137,7 @@ class UpdateManager():
|
|||
plymouth_splash()
|
||||
install_backend = get_backend(self, InstallBackend.ACTION_INSTALLONLY)
|
||||
install_backend.start()
|
||||
else:
|
||||
elif self.inhibit_lock == None:
|
||||
self.inhibit_lock.close()
|
||||
logging.info("Receive Shutdown Signal and No need to install...")
|
||||
except Exception as e:
|
||||
|
|
|
@ -59,8 +59,12 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
|
||||
self.trans_status = ''
|
||||
self.details = ''
|
||||
|
||||
#是否在安装状态 判断依据进度>50
|
||||
self.on_install_stage = False
|
||||
if self.action == self.ACTION_INSTALLONLY:
|
||||
self.on_install_stage = True
|
||||
|
||||
self.trans_cancelable = False
|
||||
|
||||
if self.action == self.ACTION_UPDATE:
|
||||
|
@ -73,14 +77,13 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
self.simulation_progress = 0
|
||||
GLib.timeout_add_seconds(1,self._check_simulation_progress)
|
||||
|
||||
elif self.action == self.ACTION_INSTALL:
|
||||
elif self.action == self.ACTION_INSTALL or self.action == self.ACTION_INSTALLONLY:
|
||||
#安装的超时间检查 超时解除禁止关机
|
||||
self.install_timestamp = time.time()
|
||||
self.check_progress = 0
|
||||
GLib.timeout_add_seconds(UPDATER_IDLE_CHECK_INTERVAL,
|
||||
self._check_install_inactivity)
|
||||
|
||||
|
||||
def _check_simulation_progress(self):
|
||||
self.simulation_progress += 20
|
||||
|
||||
|
@ -107,11 +110,15 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
#只有安装的时候启用 下载时候不使用
|
||||
timestamp = self.install_timestamp
|
||||
if (time.time() - timestamp > INSTALL_IDLE_TIMEOUT
|
||||
and self.check_progress > 50):
|
||||
and self.on_install_stage == True):
|
||||
logging.error("Quitting due to inactivity(%s)",self.details)
|
||||
|
||||
#超时只单独进行解锁关机
|
||||
unLockedEnableShutdown()
|
||||
if self.action == self.ACTION_INSTALLONLY:
|
||||
#关机安装模式 解除禁止关机锁
|
||||
self.window_maininhibit_lock.close()
|
||||
else:
|
||||
#超时只单独进行解锁关机
|
||||
unLockedEnableShutdown()
|
||||
# self._action_done(self.ACTION_INSTALL,
|
||||
# is_cancelled=False, success=False,
|
||||
# #FIXME: 安装超时退出
|
||||
|
@ -378,7 +385,7 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
elif action == self.ACTION_DOWNLOADONLY:
|
||||
#只处理从下载切换到安装时出现的网络问题
|
||||
#当网络波动时下载某些软件包失败时属于异常状态进行重试时 不发送后续进度 等待重试正常是 进行下载安装
|
||||
if self.is_version_upgrade == True and progress >= 48 and self.on_install_stage != True and 'Failed to fetch' in self.trans_error_details:
|
||||
if self.is_version_upgrade == True and progress >= 48 and 'Failed to fetch' in self.trans_error_details:
|
||||
logging.warning("Arise Failed to fetch and Need retry Upgrade...")
|
||||
self.is_need_retry = True
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue