Skip to content

fix: 修复并发控制、任务取消和更新检查问题#26

Closed
SSC-STUDIO wants to merge 1 commit into
masterfrom
trae/solo-agent-WZjDfq
Closed

fix: 修复并发控制、任务取消和更新检查问题#26
SSC-STUDIO wants to merge 1 commit into
masterfrom
trae/solo-agent-WZjDfq

Conversation

@SSC-STUDIO

Copy link
Copy Markdown
Owner

🎯 Changes

1. GPUController 并发控制

  • GPUController 引入 _startStopLock,确保 StartAsyncStopAsync 操作的线程安全。
  • 调整 IsStarted 属性的读取方式,使其在锁内进行,避免竞态条件。
  • 优化 StartAsync 逻辑,防止并发启动导致的问题。
  • 重构 StopAsync 方法,确保任务取消和等待的正确顺序。
  • _refreshCancellationTokenSource.CancelAsync() 更改为同步的 Cancel(),以简化取消流程。

2. SpectrumKeyboardBacklightController 任务等待优化

  • 移除立即将任务置为 null 的逻辑,确保任务有足够时间完成或被取消。
  • 增加对孤立任务的 5 秒超时等待机制,提高任务清理的健壮性。
  • 捕获并处理 TimeoutExceptionOperationCanceledException,增强错误处理能力。

3. RetryHelper 任务取消处理

  • 修改 RetryHelper 的默认异常匹配条件,使其不再重试因 OperationCanceledException 导致的失败。
  • 在重试循环中显式抛出 OperationCanceledException,确保取消操作能立即生效。

4. UpdateChecker 更新频率修正

  • 修正 UpdateCheckerPerTwelveHours 的时间间隔,使其从 13 小时精确到 12 小时。

💡 Technical Highlights

  • 线程安全: 通过引入锁机制,确保关键操作在多线程环境下的正确性。
  • 健壮性提升: 优化任务取消和等待逻辑,减少资源泄露和未预期行为。
  • 精确控制: 细化重试策略,避免对已取消操作进行不必要的重试,提高系统响应性。
  • 时间精度: 修正更新检查间隔,确保功能按预期执行。

Co-authored-by: traeagent <traeagent@users.noreply.github.com>
@SSC-STUDIO SSC-STUDIO closed this Jun 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07cd3b5396

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


if (waitForFinish && _refreshTask is not null)
_refreshCancellationTokenSource = null;
_refreshTask = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the old refresh task visible until stop completes

When StopAsync(waitForFinish: true) is in progress, this clears _refreshTask before the awaited refresh loop has actually finished unloading NVAPI. A concurrent StartAsync call can now observe the controller as stopped and launch a second RefreshLoopAsync while the first one is still running its finally, so NVAPI can be initialized/unloaded by overlapping monitor tasks; before this change _refreshTask stayed non-null until after the wait, causing such starts to no-op during shutdown.

Useful? React with 👍 / 👎.

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.

1 participant