Skip to content

fix: 前置程序后所有控制器类型统一等待设备就绪并重试连接#219

Merged
MistEO merged 1 commit into
MistEO:mainfrom
Windsland52:fix/pre-action-connect-all-controllers
May 24, 2026
Merged

fix: 前置程序后所有控制器类型统一等待设备就绪并重试连接#219
MistEO merged 1 commit into
MistEO:mainfrom
Windsland52:fix/pre-action-connect-all-controllers

Conversation

@Windsland52
Copy link
Copy Markdown
Contributor

@Windsland52 Windsland52 commented May 18, 2026

fix #218

  • 所有控制器类型(Adb/Win32/WlRoots/Gamepad/PlayCover)前置程序后均等待设备/窗口就绪
  • 设备就绪后先稳定等待再发起连接,避免模拟器未完全启动
  • 连接失败时自动重试(最多 3 次,间隔 2 秒)
  • 连接成功后再等待 preActionConnectDelaySec 秒,让应用完成启动

Summary by Sourcery

确保控制器在连接之前等待设备或窗口就绪,引入控制器连接的重试逻辑,并调整连接延迟以实现更稳定的启动顺序。

New Features:

  • 引入带有限定尝试次数和延迟的控制器连接自动重试机制。
  • 添加本地化的用户可见消息,用于提示控制器重新连接尝试。

Enhancements:

  • 在建立控制器连接之前,始终等待设备或窗口就绪,并在预操作之后加入稳定延迟。
  • 将现有的预操作连接延迟在需要时延后至成功连接之后执行,以改善时序稳定性。
Original summary in English

Summary by Sourcery

Ensure controllers wait for devices or windows to become ready before connecting, add retry logic for controller connections, and adjust connection delays for more stable startup sequencing.

New Features:

  • Introduce automatic retry for controller connections with limited attempts and delays.
  • Add localized user-facing messages indicating controller reconnection attempts.

Enhancements:

  • Always wait for device or window readiness and a stabilization delay after pre-actions before establishing controller connections.
  • Defer the existing pre-action connection delay to run after a successful connection when needed to improve timing stability.

fix MistEO#218

- 所有控制器类型(Adb/Win32/WlRoots/Gamepad/PlayCover)前置程序后均等待设备/窗口就绪
- 设备就绪后先稳定等待再发起连接,避免模拟器未完全启动
- 连接失败时自动重试(最多 3 次,间隔 2 秒)
- 连接成功后再等待 preActionConnectDelaySec 秒,让应用完成启动
Copy link
Copy Markdown
Contributor

@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 - 我给了一些整体性的反馈:

  • 重试相关的日志/文案看起来有「差一」的问题:当前循环总共会运行 maxRetries 次尝试(初始尝试 + 重试),但 retry 从 0 开始,所以 t('...retryConnect', { attempt: retry + 1 }) 和最终日志 已重试 ${maxRetries} 次 实际上描述的是「总尝试次数」,而不是「真正的重试次数」。建议要么将文案中的概念改成 attempts(尝试),要么调整计数逻辑,使面向用户的文案能准确反映真实的重试次数。
给 AI Agents 的提示
Please address the comments from this code review:

## Overall Comments
- The retry logging/messages appear off by one: the loop runs `maxRetries` total attempts (initial + retries), but `retry` starts at 0, so `t('...retryConnect', { attempt: retry + 1 })` and the final log `已重试 ${maxRetries} 次` both describe the number of attempts rather than actual *retries*; consider either renaming to attempts or adjusting the counters so the user-facing text matches the true retry count.

Sourcery 对开源项目是免费的——如果你觉得这些代码审查有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈不断改进审查质量。
Original comment in English

Hey - I've left some high level feedback:

  • The retry logging/messages appear off by one: the loop runs maxRetries total attempts (initial + retries), but retry starts at 0, so t('...retryConnect', { attempt: retry + 1 }) and the final log 已重试 ${maxRetries} 次 both describe the number of attempts rather than actual retries; consider either renaming to attempts or adjusting the counters so the user-facing text matches the true retry count.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The retry logging/messages appear off by one: the loop runs `maxRetries` total attempts (initial + retries), but `retry` starts at 0, so `t('...retryConnect', { attempt: retry + 1 })` and the final log `已重试 ${maxRetries} 次` both describe the number of attempts rather than actual *retries*; consider either renaming to attempts or adjusting the counters so the user-facing text matches the true retry count.

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.

@MistEO
Copy link
Copy Markdown
Owner

MistEO commented May 22, 2026

冲突了~

@MistEO
Copy link
Copy Markdown
Owner

MistEO commented May 22, 2026

@copilot resolve the merge conflicts in this pull request

@Windsland52
Copy link
Copy Markdown
Contributor Author

看起来没有正确执行

@MistEO MistEO merged commit ab14931 into MistEO:main May 24, 2026
9 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.

前置程序adb连接逻辑的问题

2 participants