mirror of
https://github.com/jahruz67/wisp-open.git
synced 2026-08-08 18:14:08 +00:00
Fix silent I/O failures and harden whisper model handling
This commit is contained in:
@@ -144,14 +144,16 @@ func (a *App) Quit() {
|
||||
wailsruntime.Quit(a.ctx)
|
||||
}
|
||||
|
||||
var lastToggle time.Time
|
||||
var lastToggleUnixNano int64
|
||||
|
||||
func (a *App) ToggleRecording() {
|
||||
// Debounce toggle calls to prevent rapid firing from double-binds or Wayland glitches
|
||||
if time.Since(lastToggle) < 500*time.Millisecond {
|
||||
now := time.Now().UnixNano()
|
||||
last := atomic.LoadInt64(&lastToggleUnixNano)
|
||||
if last != 0 && time.Duration(now-last) < 500*time.Millisecond {
|
||||
return
|
||||
}
|
||||
lastToggle = time.Now()
|
||||
atomic.StoreInt64(&lastToggleUnixNano, now)
|
||||
|
||||
if atomic.LoadInt32(&a.recording) == 1 {
|
||||
a.StopRecording()
|
||||
|
||||
Reference in New Issue
Block a user