fix(hotkey): 250ms debounce on pressed-edge dispatch#409
Merged
Conversation
避免微动开关回弹 / 用户手抖双击造成的空转写报错和 ASR session 抢资源: 相邻 < 250ms 的 press 边沿直接丢弃,记 log。 - coordinator.rs: Inner 新增 last_hotkey_dispatch_at: Mutex<Option<Instant>> - coordinator/dictation.rs: HOTKEY_DEBOUNCE 常量 + handle_pressed_edge 入口检查 与 hotkey_trigger_held 互补:held 防 press-without-release,本检查防 press-release-press 三连过快。每个有效边沿都会更新时间戳;用户正常使用 (不会快于 4 次/秒)不会触发。
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
主要改动
与 `hotkey_trigger_held` 互补:held 防 press-without-release,本检查防 press-release-press 三连过快。用户正常使用(不会快于 4 次/秒)不会触发。
Test plan
PR Type
Bug fix
Description
Add 250ms pressed-edge debounce
Drop rapid hotkey repeats
Initialize dispatch timestamp state
Diagram Walkthrough
File Walkthrough
coordinator.rs
Track last hotkey dispatch timestampopenless-all/app/src-tauri/src/coordinator.rs
last_hotkey_dispatch_attoInnerdictation.rs
Debounce rapid hotkey press edgesopenless-all/app/src-tauri/src/coordinator/dictation.rs
HOTKEY_DEBOUNCEconstant