Skip to content

fix: simplify DBus service check and add cache path prefix#113

Merged
18202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743:master
Jun 27, 2025
Merged

fix: simplify DBus service check and add cache path prefix#113
18202781743 merged 1 commit intolinuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743
Copy link
Contributor

@18202781743 18202781743 commented Jun 25, 2025

  1. Removed redundant isServiceActivatable() check in ValueHandler
    since isServiceRegistered() is sufficient
  2. Added explicit cache path prefix setting for global cache in
    DSGConfigResource to ensure proper cache location
  3. Changes improve code clarity and ensure consistent cache behavior

fix: 简化DBus服务检查并添加缓存路径前缀

  1. 在ValueHandler中移除了多余的isServiceActivatable()检查,仅保留
    isServiceRegistered()已足够
  2. 在DSGConfigResource中为全局缓存添加了明确的路径前缀设置,确保缓存位置
    正确
  3. 这些改动提高了代码清晰度并保证了缓存行为的一致性

Summary by Sourcery

Simplify the DBus service availability logic by eliminating an unnecessary check and ensure consistent cache behavior by explicitly prefixing the global cache path.

Enhancements:

  • Remove redundant DBusHandler::isServiceActivatable() check and rely solely on isServiceRegistered()
  • Add explicit cache path prefix for the global cache in DSGConfigResource to guarantee correct cache location

1. Removed redundant `isServiceActivatable()` check in ValueHandler
since `isServiceRegistered()` is sufficient
2. Added explicit cache path prefix setting for global cache in
DSGConfigResource to ensure proper cache location
3. Changes improve code clarity and ensure consistent cache behavior

fix: 简化DBus服务检查并添加缓存路径前缀

1. 在ValueHandler中移除了多余的`isServiceActivatable()`检查,仅保留
`isServiceRegistered()`已足够
2. 在DSGConfigResource中为全局缓存添加了明确的路径前缀设置,确保缓存位置
正确
3. 这些改动提高了代码清晰度并保证了缓存行为的一致性
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR streamlines the DBus service initialization by dropping the redundant activatable check and strengthens cache management by explicitly prefixing the global cache path, enhancing clarity and consistency.

Sequence diagram for simplified DBus service check in ValueHandler

sequenceDiagram
    participant ValueHandler
    participant DBusHandler
    participant DBusService

    ValueHandler->>DBusHandler: isServiceRegistered()
    alt Service is registered
        ValueHandler->>DBusHandler: createManager(appid, fileName, subpath)
        DBusHandler-->>ValueHandler: ConfigGetter instance
    else Service is not registered
        ValueHandler-->>ValueHandler: return nullptr
    end
Loading

Class diagram for ValueHandler and DBusHandler after DBus check simplification

classDiagram
    class ValueHandler {
        +ConfigGetter* createManager()
    }
    class DBusHandler {
        +static bool isServiceRegistered()
        +ConfigGetter* createManager(QString appid, QString fileName, QString subpath)
    }
    ValueHandler --> DBusHandler : uses
Loading

Class diagram for DSGConfigResource and DConfigFile with explicit cache path prefix

classDiagram
    class DSGConfigResource {
        +bool reparse(QString appid)
        +QString configPrefixPath()
    }
    class DConfigFile {
        +GlobalCache* globalCache()
        +Meta* meta()
    }
    class GlobalCache {
        +void setCachePathPrefix(QString prefix)
    }
    DSGConfigResource --> DConfigFile : creates
    DConfigFile --> GlobalCache : has
    DSGConfigResource ..> GlobalCache : sets cache path prefix
Loading

File-Level Changes

Change Details Files
Simplified DBus service availability check
  • Removed redundant isServiceActivatable() condition
  • Retained only isServiceRegistered() in creation guard
dconfig-center/common/valuehandler.cpp
Explicitly set cache path prefix for global cache
  • Inserted setCachePathPrefix(configPrefixPath()+"/global") on globalCache
  • Ensured the cache location is consistently derived from config prefix
dconfig-center/dde-dconfig-daemon/dconfigresource.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • valuehandler.cpp文件中,移除了对DBusHandler::isServiceActivatable()的检查,可能会影响服务的激活逻辑。
  • dconfigresource.cpp文件中,新增了config->globalCache()->setCachePathPrefix(configPrefixPath() + "/global");,需要确认configPrefixPath()是否已经初始化,以避免潜在的空指针异常。

是否建议立即修改:

  • 是,需要确认移除DBusHandler::isServiceActivatable()检查的影响,并确保configPrefixPath()在调用setCachePathPrefix之前已经被正确初始化。

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @18202781743 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@18202781743 18202781743 merged commit f50e9e9 into linuxdeepin:master Jun 27, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants