fix(updater): ensure upgrade delivery service exits when p2p disabled - #473
Conversation
There was a problem hiding this comment.
Sorry @qiuzhiqian, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideRefactors upgrade delivery shutdown behavior so that the service is explicitly disabled and cleared whenever P2P delivery is configured off, ensuring the D-Bus-activated service exits even after status calls, and reuses a new helper from both the refresh logic and the P2P toggle path. Sequence diagram for upgradedelivery shutdown when P2P is disabledsequenceDiagram
participant Updater
participant UpdaterDBusAPI as Updater_dbus
participant UpgradeDelivery as upgradedelivery_dbus
UpdaterDBusAPI->>Updater: SetP2PUpdateEnable(sender, enable)
Updater->>Updater: setPropP2PUpdateEnable(enable)
alt enable is false and property changed
Updater->>Updater: disableDeliveryService()
Updater->>UpgradeDelivery: Call org.deepin.upgradedelivery.DisableService
Updater->>UpgradeDelivery: Call org.deepin.upgradedelivery.Clear
end
Updater->>Updater: refreshUpgradeDeliveryService()
Updater->>Updater: shouldEnableUpgradeDeliveryService(config, platformHasDelivery)
alt shouldEnableService is false
Updater->>Updater: disableDeliveryService()
Updater->>UpgradeDelivery: Call org.deepin.upgradedelivery.DisableService
Updater->>UpgradeDelivery: Call org.deepin.upgradedelivery.Clear
Updater->>Updater: setPropP2PUpdateEnable(false)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
CLA Assistant Lite bot: |
Calling the upgradedelivery ServiceStatus D-Bus method activates the service even when it is configured disabled, leaving it running after refresh. Add a helper that invokes DisableService and Clear on the disabled path in refreshUpgradeDeliveryService, and also trigger DisableService when SetP2PUpdateEnable(false) is called, so the delivery service exits properly. PMS: BUG-372269
b2bf22b to
6484b4a
Compare
deepin pr auto review★ 总体评分:85分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 diff --git a/src/lastore-daemon/updater.go b/src/lastore-daemon/updater.go
index d1c73c76c..e12345678 100644
--- a/src/lastore-daemon/updater.go
+++ b/src/lastore-daemon/updater.go
@@ -247,8 +247,6 @@ func (u *Updater) refreshUpgradeDeliveryService() {
}
shouldEnableService := shouldEnableUpgradeDeliveryService(u.config, platformHasDelivery)
- logger.Infof("delivery shouldEnableService=%+v, serviceStatus=%+v", shouldEnableService, serviceStatus)
// 应用 UpgradeDeliveryEnabled 配置
if shouldEnableService {
// 配置启用:期望服务开启 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: qiuzhiqian, zhaohuiw42 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Calling the upgradedelivery ServiceStatus D-Bus method activates the service even when it is configured disabled, leaving it running after refresh. Add a helper that invokes DisableService and Clear on the disabled path in refreshUpgradeDeliveryService, and also trigger DisableService when SetP2PUpdateEnable(false) is called, so the delivery service exits properly.
Summary by Sourcery
Ensure the upgrade delivery (P2P) service is reliably shut down when it is disabled via configuration or D-Bus API.
Bug Fixes:
Enhancements: