Skip to content

Conversation

@wyu71
Copy link
Contributor

@wyu71 wyu71 commented Oct 27, 2025

  • Fixed GetValueBool call to use correct dsgKeyAutoSwitchPort instead of dsgkeyPausePlayer
  • Corrected log message to properly indicate "pause player" value

Log: correct config key in DSG property initialization
pms: BUG-338349

Summary by Sourcery

Correct the DSG property initialization by using the proper config key for autoSwitchPort and updating the log message for pause player

Bug Fixes:

  • Use correct DSG configuration key for autoSwitchPort instead of pause player
  • Fix log message to correctly display pause player value

@sourcery-ai
Copy link

sourcery-ai bot commented Oct 27, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates DSG property initialization to use the correct config key and aligns the log message to reflect the pause player setting.

Class diagram for updated Audio property initialization

classDiagram
class Audio {
  +audioDConfig
  +PropsMu
  +PausePlayer bool
  +initDsgProp() error
  +setEnableAutoSwitchPort(value bool)
}
class audioDConfig {
  +GetValueBool(key string) (bool, error)
}
Audio --> audioDConfig: uses
Loading

File-Level Changes

Change Details Files
Use correct DSG config key
  • Replaced dsgkeyPausePlayer with dsgKeyAutoSwitchPort in GetValueBool call
audio1/audio.go
Align log message with property
  • Changed logger.Info label from 'auto switch port:' to 'pause player:'
audio1/audio.go

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

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 there - 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.

- Fixed GetValueBool call to use correct dsgKeyAutoSwitchPort instead of dsgkeyPausePlayer
- Corrected log message to properly indicate "pause player" value

Log: correct config key in DSG property initialization
pms: BUG-338349
@deepin-ci-robot
Copy link

deepin pr auto review

我来对这个代码变更进行审查:

  1. 语法逻辑:
  • 代码变更将 dsgkeyPausePlayer 改为 dsgKeyAutoSwitchPort,这看起来像是一个配置键名的更改。
  • 同时修改了日志输出信息,从 "auto switch port:" 改为 "pause player:"。
  • 这里存在一个逻辑不一致的问题:键名改成了 dsgKeyAutoSwitchPort(自动切换端口),但日志输出却改成了 "pause player"(暂停播放器),这两者似乎不匹配。
  1. 代码质量:
  • 代码使用了适当的互斥锁(PropsMu)来保护共享状态,这是好的实践。
  • 错误处理采用了 logger.Warning(),符合错误处理规范。
  • 但是日志信息与实际操作的键名不匹配,这可能会给调试带来困惑。
  1. 代码性能:
  • 这部分代码主要涉及配置读取和日志记录,对性能影响较小。
  • 使用了互斥锁来保护共享状态,是必要的同步开销。
  1. 代码安全:
  • 使用了互斥锁保护共享状态,避免了竞态条件。
  • 对配置读取的错误进行了适当的处理。

改进建议:

  1. 需要统一命名和日志信息的含义。如果是要读取自动切换端口的配置,那么日志信息应该反映这一点:
val, err := a.audioDConfig.GetValueBool(dsgKeyAutoSwitchPort)
if err != nil {
    logger.Warning(err)
}
logger.Info("auto switch port:", val)
  1. 如果是要读取暂停播放器的配置,那么键名应该保持一致:
val, err := a.audioDConfig.GetValueBool(dsgkeyPausePlayer)
if err != nil {
    logger.Warning(err)
}
logger.Info("pause player:", val)
  1. 建议添加注释说明这个配置项的具体用途,以便其他开发者理解。

  2. 考虑将配置键名定义为常量,以避免拼写错误:

const (
    DsgKeyAutoSwitchPort = "dsg.auto.switch.port"
    DsgKeyPausePlayer = "dsg.pause.player"
)

请根据实际需求选择合适的修改方案,确保代码的逻辑一致性。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, wyu71

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

@wyu71
Copy link
Contributor Author

wyu71 commented Oct 29, 2025

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Oct 29, 2025

This pr force merged! (status: unstable)

@deepin-bot deepin-bot bot merged commit a9357f7 into linuxdeepin:master Oct 29, 2025
14 of 17 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