Skip to content

Commit 33f0cbd

Browse files
committed
fix: resolve lastore-daemon service registration status check issue
The update service registration was failing to properly check system status after the lastore-daemon became valid. Previously, the wait service timer was not being stopped when the check system was called from the timer callback, causing potential race conditions. Additionally, the doCheckSystem method contained the D-Bus service validity check, which was moved to a new checkSystem method that properly handles the waiting logic before calling doCheckSystem. Log: Fixed system check after lastore-daemon service registration Influence: 1. Test system check functionality when lastore-daemon service is already valid 2. Test system check when lastore-daemon service is not yet available and becomes valid later 3. Verify that wait service timer is properly stopped when service becomes valid 4. Verify that system check is not triggered twice due to timer race conditions 5. Test upgrade workflow end-to-end to ensure proper system check execution fix: 修复lastore-daemon服务注册后获取状态问题 更新服务注册时,在lastore-daemon变为有效后未能正确检查系统状态。之前从 定时器回调调用checkSystem时没有停止等待服务定时器,可能导致竞态条件。 此外,doCheckSystem方法包含了D-Bus服务有效性检查,现在将其移动到新的 checkSystem方法中,该方法在调用doCheckSystem之前正确处理等待逻辑。 Log: 修复lastore-daemon服务注册后的系统检查 Influence: 1. 测试lastore-daemon服务已生效时的系统检查功能 2. 测试lastore-daemon服务尚未就绪后变为可用时的系统检查 3. 验证服务可用时等待服务定时器是否正常停止 4. 验证不会因定时器竞态条件导致系统检查被触发两次 5. 测试完整升级流程,确保系统检查正常执行 PMS: BUG-361789 Change-Id: I5de82d873a864673eb06482f09109c32f10cdc8f
1 parent c3a2c6f commit 33f0cbd

3 files changed

Lines changed: 21 additions & 11 deletions

File tree

src/dde-update/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
135135
new FullScreenManager(createFrame);
136136

137137
if (!whetherDoUpgrade) {
138-
UpdateWorker::instance()->doCheckSystem(UpdateModel::instance()->updateMode(), UpdateModel::instance()->checkSystemStage());
138+
UpdateWorker::instance()->checkSystem(UpdateModel::instance()->updateMode(), UpdateModel::instance()->checkSystemStage());
139139
}
140140

141141
return app->exec();

src/dde-update/updateworker.cpp

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -76,6 +76,9 @@ void UpdateWorker::init()
7676
} else {
7777
if (m_waitingToCheckSystem) {
7878
m_waitingToCheckSystem = false;
79+
if (m_waitServiceTimer->isActive()) {
80+
m_waitServiceTimer->stop();
81+
}
7982
doCheckSystem(UpdateModel::instance()->updateMode(), UpdateModel::instance()->checkSystemStage());
8083
}
8184
}
@@ -108,6 +111,19 @@ void UpdateWorker::startUpdateProgress()
108111
doDistUpgradeIfCanBackup();
109112
}
110113

114+
void UpdateWorker::checkSystem(int updateMode, UpdateModel::CheckSystemStage stage)
115+
{
116+
qCInfo(logUpdateModal) << "Check system with update mode:" << updateMode << "check system stage:" << stage;
117+
if (!m_dbusProxy->managerInterIsValid()) {
118+
qCWarning(logUpdateModal) << "org.deepin.dde.Lastore1 interface is invalid, wait for service to be valid";
119+
m_waitingToCheckSystem = true;
120+
m_waitServiceTimer->start();
121+
return;
122+
}
123+
124+
doCheckSystem(updateMode, stage);
125+
}
126+
111127
void UpdateWorker::doDistUpgrade(bool doBackup)
112128
{
113129
qCInfo(logUpdateModal) << "Do dist upgrade, do backup: " << doBackup;
@@ -387,14 +403,7 @@ void UpdateWorker::doDistUpgradeIfCanBackup()
387403

388404
void UpdateWorker::doCheckSystem(int updateMode, UpdateModel::CheckSystemStage stage)
389405
{
390-
qCInfo(logUpdateModal) << "Update mode:" << updateMode << ", check system stage:" << stage;
391-
if (!m_dbusProxy->managerInterIsValid()) {
392-
qCWarning(logUpdateModal) << "org.deepin.dde.Lastore1 interface is invalid, wait for service to be valid";
393-
m_waitingToCheckSystem = true;
394-
m_waitServiceTimer->start();
395-
return;
396-
}
397-
406+
qCInfo(logUpdateModal) << "doCheckSystem Update mode:" << updateMode << ", check system stage:" << stage;
398407
QDBusPendingReply<QDBusObjectPath> reply = m_dbusProxy->CheckUpgrade(updateMode, static_cast<int>(stage));
399408
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
400409
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher] {

src/dde-update/updateworker.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -43,6 +43,7 @@ class UpdateWorker : public QObject
4343
void doCheckSystem(int updateMode, UpdateModel::CheckSystemStage stage);
4444
void doAction(UpdateModel::UpdateAction action);
4545
void startUpdateProgress();
46+
void checkSystem(int updateMode, UpdateModel::CheckSystemStage stage);
4647
bool checkPower();
4748
void enableShortcuts(bool enable);
4849
void doPowerAction(bool reboot);

0 commit comments

Comments
 (0)