핫키 press/release race condition 수정

- _handleRelease: 200ms 딜레이 제거 → 즉시 stopSession()
  (딜레이 중 새 press가 와서 세션 꼬이는 버그 수정)
- _resetToIdle: 200ms 딜레이 제거 → 즉시 IDLE 복귀
  (딜레이 때문에 다음 핫키가 안 먹히는 버그 수정)
This commit is contained in:
Yun Chan 2026-04-05 10:35:45 +09:00
parent 18d5fef594
commit 84b9d906be

View file

@ -536,13 +536,9 @@ class VoiceModeService extends EventEmitter {
this._audioStarted = false
this._errorEmitted = false
// 약간의 딜레이 후 IDLE로 전이 (UI 애니메이션용)
setTimeout(() => {
if (!this._session) {
this._setRecognitionState(RecognitionState.IDLE)
this._setAudioState(AudioState.IDLE)
}
}, 200)
// 즉시 IDLE로 전이 (딜레이는 race condition 유발)
this._setRecognitionState(RecognitionState.IDLE)
this._setAudioState(AudioState.IDLE)
}
// ── 에러 처리 ──────────────────────────────────────────
@ -621,10 +617,10 @@ class VoiceModeService extends EventEmitter {
}
}
private async _handleRelease(action: VoiceAction): Promise<void> {
if (action.mode === 'dictation' && this.isActive) {
// Dictation: hold-to-talk — release로 종료 (200ms 딜레이)
await new Promise<void>((resolve) => setTimeout(resolve, 200))
private async _handleRelease(_action: VoiceAction): Promise<void> {
if (_action.mode === 'dictation' && this.isActive) {
// Dictation: hold-to-talk — release로 즉시 종료
// Speakly 패턴: 딜레이 없이 즉시 stop (딜레이가 race condition 유발)
await this.stopSession()
}
// HandsFree: release 무시