From 84b9d906beb7e056893f5793163bbf4f9653227e Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Sun, 5 Apr 2026 10:35:45 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=AB=ED=82=A4=20press/release=20race=20con?= =?UTF-8?q?dition=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _handleRelease: 200ms 딜레이 제거 → 즉시 stopSession() (딜레이 중 새 press가 와서 세션 꼬이는 버그 수정) - _resetToIdle: 200ms 딜레이 제거 → 즉시 IDLE 복귀 (딜레이 때문에 다음 핫키가 안 먹히는 버그 수정) --- src/main/services/VoiceModeService.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/services/VoiceModeService.ts b/src/main/services/VoiceModeService.ts index 41d01da..47e6f54 100644 --- a/src/main/services/VoiceModeService.ts +++ b/src/main/services/VoiceModeService.ts @@ -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 { - if (action.mode === 'dictation' && this.isActive) { - // Dictation: hold-to-talk — release로 종료 (200ms 딜레이) - await new Promise((resolve) => setTimeout(resolve, 200)) + private async _handleRelease(_action: VoiceAction): Promise { + if (_action.mode === 'dictation' && this.isActive) { + // Dictation: hold-to-talk — release로 즉시 종료 + // Speakly 패턴: 딜레이 없이 즉시 stop (딜레이가 race condition 유발) await this.stopSession() } // HandsFree: release 무시