-
Notifications
You must be signed in to change notification settings - Fork 42
fix: Fix Linglong upgrade repeatedly sending remove signal #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Fix Linglong upgrade repeatedly sending remove signal Log: Fix Linglong upgrade repeatedly sending remove signal pms: BUG-340923
Reviewer's guide (collapsed on small PRs)Reviewer's GuideIncreases the debounce interval for the application reload timer to reduce repeated Linglong upgrade removal signals. Sequence diagram for debounced Linglong upgrade application reloadsequenceDiagram
actor Linglong
participant ApplicationManager1Service
participant QTimer_m_reloadTimer as QTimer_m_reloadTimer
participant ApplicationStore
Linglong->>ApplicationManager1Service: notifyUpgradeEvent()
ApplicationManager1Service->>QTimer_m_reloadTimer: start(interval=500ms, singleShot=true)
Linglong->>ApplicationManager1Service: notifyUpgradeEvent()
ApplicationManager1Service->>QTimer_m_reloadTimer: restart(interval=500ms)
Linglong->>ApplicationManager1Service: notifyUpgradeEvent()
ApplicationManager1Service->>QTimer_m_reloadTimer: restart(interval=500ms)
QTimer_m_reloadTimer-->>ApplicationManager1Service: timeout()
ApplicationManager1Service->>ApplicationStore: doReloadApplications()
ApplicationStore-->>ApplicationManager1Service: reloadCompleted()
Updated class diagram for ApplicationManager1Service reload timer debounceclassDiagram
class ApplicationManager1Service {
- QTimer m_reloadTimer
+ ApplicationManager1Service(IdentifierManager identifierManager, QObject parent)
+ void doReloadApplications()
}
class QTimer {
+ void setInterval(int msec)
+ void setSingleShot(bool singleShot)
+ void start()
+ void stop()
+ signal timeout()
}
ApplicationManager1Service --> QTimer : uses m_reloadTimer
note for ApplicationManager1Service "m_reloadTimer interval increased from 50ms to 500ms to reduce repeated remove signals"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deepin pr auto review这段代码修改将 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
综合改进建议虽然当前的修改在功能上是正确的,但为了提高代码的健壮性和可维护性,建议进行以下优化: // 在类定义或匿名命名空间中定义常量
namespace {
constexpr int kReloadDebounceIntervalMs = 500; // 定义防抖动间隔
}
// 构造函数中的使用
ApplicationManager1Service::ApplicationManager1Service(std::unique_ptr<Identifier> identifier)
: ApplicationManager1(std::move(identifier))
{
// ... 其他代码 ...
// 使用常量替代字面量,并添加注释说明意图
// 设置 500ms 的延迟以合并短时间内频繁触发的重载请求(防抖动)
m_reloadTimer.setInterval(kReloadDebounceIntervalMs);
m_reloadTimer.setSingleShot(true);
connect(&m_reloadTimer, &QTimer::timeout, this, &ApplicationManager1Service::doReloadApplications);
}总结:将间隔调整为 500ms 是一个合理的性能优化,特别是在处理频繁触发的重载事件时。建议通过定义常量和添加注释来进一步提升代码质量。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ComixHe, pengfeixx 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 |
Fix Linglong upgrade repeatedly sending remove signal
Log: Fix Linglong upgrade repeatedly sending remove signal
pms: BUG-340923
Summary by Sourcery
Bug Fixes: